emacs-devel
[Top][All Lists]
Advanced

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

Re: Amending commits


From: Stefan Monnier
Subject: Re: Amending commits
Date: Sun, 25 Sep 2022 15:26:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> 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.


        Stefan




reply via email to

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