Subject: Re: On-branch topic description support?

From: Junio C Hamano <[email-masked]>
Date: Thu, 21 Jul 2022 10:35:51 -0700

Konstantin Ryabitsev <[email-masked]> writes:

> On Thu, Jul 21, 2022 at 04:53:18PM +0200, Ævar Arnfjörð Bjarmason wrote:
>> I tried now with "git rebase --rebase-merges -i", and it supports it
>> properly, i.e. I could re-arrange it so that it's:
>> 
>>               A---C---B---M topic
>>              / \         /
>>         X---Y   ---------
>>              \
>>               master
>
> This is clever, but it has a hard restriction that nothing happens to A:
>
> - you can't move it so it's B---A---C---M
> - you can't squash A+B
>
> Unless all the tools are taught to properly modify the merge commit.
>
> Or am I not reading this right?

I think the drawing is about a two-commit topic that has B and C

Or the drawing is wrong and M's other parent should have been Y.
IOW, "git merge-base M^1 M^2" is the bottom of the topic (and our
ranges always exclude the bottom end, X..Y does not include X but
does include Y).  "git rev-list M^1...M^2" are the commits on the
topic.

Then you can shuffle A--B--C in whatever way you like with "rebase
-i" or "filter-branch", using "git merge-base M^1 M^2" as the base.