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

Re: Git feature request: --amend older commit

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Aug 17, 2012, 16:33 UTC
Message-ID
<502E725B.2040906@alum.mit.edu>
In-Reply-To
<20120817154749.11762.qmail@science.horizon.com>
On 08/17/2012 05:47 PM, George Spelvin wrote:
Show 13 quoted lines
> With git's "commit frequently" style, I often find that I end up with a
> commit that includes a typo in a comment or I forgot one call site when
> updating functions or something.
>
> And it's a few commits later before I notice the simple oops.
>
> This is of course fixable by making a commit, rebase -i HEAD~4 (or whatever),
> and marking the fixup for squashing into the previous commit.
>
> But it would be really handy if there were a one-step command for doing this.
>
> Something like "git commit --fixup HEAD~3", where "git commit --fixup HEAD"
> would be equivalent to "git commit --amend". [...]

Have you tried "git rebase --autosquash"? It does part of what you are asking for and additionally allows multiple fixup commits to be queued up and processed in a single rebase.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: George SpelvinNext: George Spelvin
Message 2 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.