git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: FEATURE suggestion git commit --amend <ref>

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 27, 2009, 10:30 UTC
Message-ID
<alpine.DEB.1.00.0902271121590.6600@intel-tinevez-2-302>
In-Reply-To
<81bfc67a0902262345i63386076rbcf6d71ed88c29ac@mail.gmail.com>
Hi,
On Fri, 27 Feb 2009, Caleb Cushing wrote:
Show 8 quoted lines
> git rebase -i seems a little more tedious/unfriendly than I'd like if 
> all I want to do is edit HEAD~2 (assuming no merges) it's a bit of a 
> pain to do a rebase -i and then pick which patches to edit. might be 
> nice to be able to do stuff like git commit --amend <ref> and have that 
> call rebase (as I think not rebasing is impossible?) with edit only on 
> the ref I picked.
> 
> hopefully I've explained well enough.
Yes, but IMHO you did not consider the undesired side effects well enough.
For example: What about merges?

To be clear: amending a merge is not just a matter of "rebase -i <commit>^" with a custom script, and even worse, there could be merges between the commit you want to amend and the current HEAD. That is a complete Pandora box right there.

Also, your amended changes could break reapplication of the later commits. So "git commit --amend <ref-other-than-HEAD>" is _semantically_ different from "git commit --amend".

Of course, there is also the problem that <ref> might not be an ancestor of HEAD to begin with.

And that the specified commit could be part of more than one branch, adding to user's confusion when it is only rewritten in the current branch.

But more fundamental: is this operation something we want to make _that_ easy? After all, it is _not_ the common case, and it bears such a bunch of problems that the user should be made well aware of what she is doing.

All in all, as with many feature requests, I have to say that I see what you want, but the side effects are too horrible -- and you did not consider them, obviously, otherwise you would have put forward arguments as to why the side effects would not matter that much.

Ciao, Dscho

Previous: Wincent ColaiutaNext: Michael J Gruber
Message 4 of 5 in “FEATURE suggestion git commit --amend <ref>”
  1. Caleb CushingFeb 27, 2009
  2. Sverre RabbelierFeb 27, 2009
  3. Wincent ColaiutaFeb 27, 2009
  4. Johannes SchindelinFeb 27, 2009
  5. Michael J GruberFeb 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.