[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Amending commits
From: |
Dmitry Gutov |
Subject: |
Re: Amending commits |
Date: |
Sun, 25 Sep 2022 23:37:01 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
On 25.09.2022 23:15, Gregory Heytings 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").
Hmm... no, AFAIU, it means that (by default) you cannot replace the
commit history of a public repository with commits which do not have the
HEAD of the public repository as their parent. E.g. if your public
repository is
A - B - C - D
^ HEAD
you cannot change it into
B - C - D
/
A - E - F - G
^ HEAD
You can even do that (if 'force pushes' are not disabled in the
repository's settings).
It's just usually a bad idea.
So you can rewrite history, but commits are "immutable".
- Re: Amending commits, (continued)
- Re: Amending commits, Manuel Giraud, 2022/09/25
- Re: Amending commits, Gregory Heytings, 2022/09/25
- Re: Amending commits, Stefan Monnier, 2022/09/25
- Re: Amending commits, Gregory Heytings, 2022/09/25
- Re: Amending commits,
Dmitry Gutov <=
- Re: Amending commits, Gregory Heytings, 2022/09/25
- Re: Amending commits, Stefan Monnier, 2022/09/25
- Re: Amending commits, Gregory Heytings, 2022/09/26
- Re: Amending commits, Andreas Schwab, 2022/09/26
- Re: Amending commits, Gregory Heytings, 2022/09/26
- Re: Amending commits, Andreas Schwab, 2022/09/26
- Re: Amending commits, Gregory Heytings, 2022/09/26
- Re: Amending commits, Andreas Schwab, 2022/09/26
- Re: Amending commits, Gregory Heytings, 2022/09/26
- Re: Amending commits, Andreas Schwab, 2022/09/26