Re: Bug in rebase --autosquash
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 19, 2022, 16:53 UTC
- Message-ID
- <xmqqpmgwmaxx.fsf@gitster.g>
- In-Reply-To
- <8p78q4p9-9ro4-p5s4-r738-7sno17rqr414@tzk.qr>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
> This demonstrates a somewhat obscure feature where the `fixup!` of a > `fixup!` magically targets the original commit. > > I understand that it is somewhat unintuitive that `fixup! fixup! abc` does > not target `fixup! abc` but instead `abc`, but that's how the tool has > been behaving forever.
It certainly is handy when the original commit A has a fixup commit B, which gets later fixed up by another commit C, resulting in a sequence like this:
$ git rebase -i A~1 C
pick A original commit
fixup B fixup! original commit
fixup C fixup! fixup! original commitBut if the user for some reason finds it is not quite ready to touch the original commit by squashing in the fixes, it may be reasonable to want to squash the two fixes together, so that it can later be applied to the original commit. And it would be one natural way to request that with
$ git rebase -i A C
that is, leave the history up to A intact, but everything above tweaked. Without --autosquash, you would get
pick B fixup! original commit
pick C fixup! fixup! original commitand you would manually do
pick B fixup! original commit
fixup C fixup! fixup! original committo squash B and C together into a single fix-up to be applied later. It does not look all too unreasonable to expect the "--autosquash" feature to do that automatically for you.
Thanks.