emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Amending commits


From: Alan Mackenzie
Subject: Re: Amending commits
Date: Sun, 25 Sep 2022 20:17:40 +0000

Hello, Stefan.

On Sun, Sep 25, 2022 at 15:26:39 -0400, Stefan Monnier wrote:
> >> As someone who does not really understand Git, does this mean we are
> >> rewriting the log message without also committing a change?  I thought
> >> that was not allowed by Git.
> > git commit --amend is mainly used to change a commit before pushing
> > it.  Rewriting history (i.e. changing an already public commit) is (by
> > default) not possible.

> When people say that in Git you cannot rewrite history, what it means is
> that you can't change anything about a given *commit id* (aka
> "revision").
> Of course, you can create a new revision (i.e. a different commit id)
> with any content you like.  Things like `rebase` and `filter-repo` are
> more general version of `commit --amend` and work in the same way, by
> writing a whole new history.

At the risk of drifting off topic, this is a misfeature of git (and
other VCSs).  When people commit software changes, and get it wrong,
this can be fixed by another commit.

When people commit software changes and get the commit message wrong,
this cannot be fixed.  Whether it be misspelling somebody's name,
missing out the bug number, or whatever, mistakes can't be corrected.

This seems to have been caused by a misunderstanding by the authors of
git (and other VCSs), who thought that the commit message was a
fundamental part of the commit.  It's not, any more than the label on a
bottle of beer is part of the beer.  You don't drink labels, just as you
don't ship commit messages to the users of (binary) software.

Those authors thought that nobody makes mistakes in their commit
messages.  Or at least, nobody that matters.  They, of course, never
make such mistakes themselves.  ;-)  It would have been a simple enough
matter, in a VCS, for the commit message for a specific commit itself to
have had revisions.  Instead, we have repositories filled with unfixable
errors.

Rant over.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]