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

A couple of rebase --autosquash proposals

From
Brett Randall <javabrett@gmail.com>
Date
Dec 9, 2013, 02:23 UTC
Message-ID
<CALeEUB4mTpd9tHJCC9Ffrfe6L=m0+gaDsXYSFGaO_tMcxCX_nA@mail.gmail.com>
Hi,

I am using Git 1.8.4.3 compiled by me on OEL6. I'd like to be able to use rebase --autosquash like this:

====================== # git log

commit b94f970cd869dfbf5254b19867fa7200df732d4f
Author: Me <me@me.com>
Date:   Mon Dec 9 17:02:32 2013 -0800
    fixup!
    This is a second fixup.
commit 64e516c8b26b7e0531a1e8b2fc8dfa21de259b85
Author: Me <me@me.com>
Date:   Sun Dec 8 17:02:32 2013 -0800
    fixup!
    This is a meaningful commit-log message, on a new line, that will
be discarded later during rebase --autosquash.
commit f21cd48d5eeac92130dc0617252c6ee6989c0252
Author: Me <me@me.com>
Date:   Tue Dec 3 21:47:52 2013 -0800
    This is the commit that will be fixed-up.
commit 259c0eb41ef16ac94868ee3c9253ba938ed24c9f
Author: Me <me@me.com>
Date:   Mon Dec 2 21:47:52 2013 -0800
    This commit is origin/master.
======================
then
# git rebase -i --autosquash 259c0eb41ef16ac94868ee3c9253ba938ed24c9f
The differences here are:
* fixup! or squash! on it's own would default to fixing-up the
previous commit (or result of previous step of rebase if that was a
squash/fixup).  Interestingly using HEAD~1 or HEAD^1 works, but it
only works for a single fixup/squash.  Is there another treeish that
would work?
* Allow real commit-log text, perhaps only on lines other than the
first line (the one containing the fixup).
The motivations are:
* I can default a fixup to apply to the previous commit (a common
wish) without explicitly stating it's treeish or commit-message.
* I can easily apply multiple fixups.
* I can retain a meaningful WIP commit-log prior to the rebase - I can
still see what each commit does, without needing to forgo the future
autosquash capability - just put the !fixup or !squash on the first
line on its own, and put the real changes on line 2 and onwards.  In
the case of squash! instead of fixup!, this means I could retain some
valuable text to be squashed into the original commit.
Thoughts on these two ideas?

Thanks Brett

Next: Johannes Sixt
Message 1 of 7 in “A couple of rebase --autosquash proposals”
  1. Brett RandallDec 9, 2013
  2. Johannes SixtDec 9, 2013
  3. Chris PackhamDec 9, 2013
  4. Philippe VaucherDec 9, 2013
  5. Brett RandallDec 9, 2013
  6. Junio C HamanoDec 9, 2013
  7. Brett RandallDec 9, 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.