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

Re: Git feature request: --amend older commit

From
Jared Hance <jaredhance@gmail.com>
Date
Aug 18, 2012, 01:41 UTC
Message-ID
<20120818014139.GA11100@gentoo.cinci.rr.com>
In-Reply-To
<20120817154749.11762.qmail@science.horizon.com>
On Fri, Aug 17, 2012 at 11:47:49AM -0400, George Spelvin wrote:
> Something like "git commit --fixup HEAD~3", where "git commit --fixup HEAD"
> would be equivalent to "git commit --amend".

Aside from the ways others mentioned on how to do this, I think that a better interface if this were to be added would be to make the commit an optional parameter of --amend. Adding another parameter which effectively does a superset of --amend sounds unnecessary.

I often want to amend a commit, but its simply too much work, so I usually commit it marking the message as something like "fixup! ...". Then, before I push, I make sure to rebase all of the commits marked as fixups. Clearly autosquash does this, but to have to override the editor as "true" is just a hassle.

I feel like this is a common enough need that it deserves more first class support than relying on the rebase command and then using true as an editor. Either it should be supported natively or it should be possible to autosquash a rebase without --interactive, since at present --autosquash requires --interactive, which isn't nice for when the user does not want the rebase to be interactive. Such a simple task shouldn't require an interactive command.

Previous: Thomas RastNext: Junio C Hamano
Message 5 of 6 in “Git feature request: --amend older commit”
  1. George SpelvinAug 17, 2012
  2. Michael HaggertyAug 17, 2012
  3. George SpelvinAug 17, 2012
  4. Thomas RastAug 17, 2012
  5. Jared HanceAug 18, 2012
  6. Junio C HamanoAug 18, 2012

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.