A couple of rebase --autosquash proposals
From: Brett Randall <hidden>
Date: 2016-06-15 22:59:25
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 [off-list ref]
Date: Mon Dec 9 17:02:32 2013 -0800
fixup!
This is a second fixup.
commit 64e516c8b26b7e0531a1e8b2fc8dfa21de259b85
Author: Me [off-list ref]
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 [off-list ref]
Date: Tue Dec 3 21:47:52 2013 -0800
This is the commit that will be fixed-up.
commit 259c0eb41ef16ac94868ee3c9253ba938ed24c9f
Author: Me [off-list ref]
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