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

Re: Git feature request: --amend older commit

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 17, 2012, 16:37 UTC
Message-ID
<87628heapy.fsf@thomas.inf.ethz.ch>
In-Reply-To
<20120817154749.11762.qmail@science.horizon.com>
"George Spelvin" <linux@horizon.com> writes:
> 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.
[...]
> 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".

Umm, --fixup is already taken and makes the subject be 'fixup! <subject of argument>'. This can then be used by rebase -i --autosquash (or rebase.autosquash=true) to automatically put the fixup(s) that have accumulated into the right places. In addition, git-rebase learned to automatically use the upstream as the default base.

So for me it's usually a matter of
  git add -p
  git commit --fixup=...
  # repeat the above two until all fixups are lined up
  git rebase -i
  # close editor without making changes
Is that still too much effort?
<plug mode=shameless>
The ideas discussed in
  http://thread.gmane.org/gmane.comp.version-control.git/202535/focus=202569
also help selecting the fixup argument more quickly.
</plug>
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: George SpelvinNext: Jared Hance
Message 4 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.