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

Re: git interactive rebase 'consume' command

From
John Keeping <john@keeping.me.uk>
Date
Jan 20, 2013, 14:17 UTC
Message-ID
<20130120141725.GL31172@serenity.lan>
In-Reply-To
<kdgtir$apt$1@ger.gmane.org>
On Sun, Jan 20, 2013 at 03:05:18PM +0100, Stephen Kelly wrote:
Show 29 quoted lines
> I find the fixup command during an interactive rebase useful.
> 
> Sometimes when cleaning up a branch, I end up in a situation like this:
> 
>  pick 07bc3c9 Good commit.
>  pick 1313a5e Commit to fixup into c2f62a3.
>  pick c2f62a3 Another commit.
> 
> So, I have to reorder the commits, and change 1313a5e to 'f'. An alternative 
> would be to squash 's' c2f62a3 into 1313a5e and clean up the commit message. 
> The problem with that is it ends up with the wrong author time information.
> 
> So, I usually reorder and then fixup, but that can also be problematic if I 
> get a conflict during the re-order (which is quite likely).
> 
> I would prefer to be able to mark a commit as 'should be consumed', so that:
> 
>  pick 07bc3c9 Good commit.
>  consume 1313a5e Commit to fixup into c2f62a3.
>  pick c2f62a3 Another commit.
> 
> will result in 
> 
>  pick 07bc3c9 Good commit.
>  pick 62a3c2f Another commit.
> 
> directly.
> 
> Any thoughts on that? 

Are you aware of the "--autosqush" option to git-rebase (and the "rebase.autosquash" config setting)? I find that using that combined with the "--fixup" option to git-commit makes this workflow a lot more intuitive.

(Which is not to say that I wouldn't find an option like 'consume' useful but I find myself reordering the list very rarely since I started using "git commit --fixup=...".)

John
Previous: Stephen KellyNext: Stephen Kelly
Message 2 of 10 in “git interactive rebase 'consume' command”
  1. Stephen KellyJan 20, 2013
  2. John KeepingJan 20, 2013
  3. Stephen KellyJan 20, 2013
  4. Junio C HamanoJan 20, 2013
  5. Stephen KellyJan 20, 2013
  6. Junio C HamanoJan 20, 2013
  7. Jeff KingJan 21, 2013
  8. Stephen KellyJan 21, 2013
  9. Michael HaggertyJan 21, 2013
  10. Stephen KellyJan 21, 2013

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.