Re: [PATCH] rebase -i: only automatically amend commit if HEAD did not change
- From
Avery Pennarun <apenwarr@gmail.com>
- Date
- Jul 22, 2008, 22:22 UTC
- Message-ID
- <32541b130807221522r2a43c49cl6400f00dbe7451a0@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.1.00.0807222235520.8986@racer>
On 7/22/08, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 6 quoted lines
> If the user called "rebase -i", marked a commit as "edit", "rebase > --continue" would automatically amend the commit when there were > staged changes. > > However, this is actively wrong when the current commit is not the > one marked with "edit". So guard against this.
This patch is perhaps a symptom of something I've been meaning to ask about for a while.
Why doesn't "edit" just stage the commit and not auto-commit it at all? That way an amend would *never* be necessary, and rebase --continue would always do a commit -a (if there was anything left to commit). The special case fixed by this patch would thus not be needed.
It would also make it more obvious how to remove files from a commit, for example, without having to learn about "git reset". For that matter, you wouldn't have to learn about "git commit --amend" either, and it would save typing.
It would also be a little more consistent with "squash", which already lets you edit the commit message by default.
Just a thought. Presumably it was implemented the way it is for some reason, but I haven't seen any discussion about it.
Have fun,
Avery