On Thu, Jul 21 2022, Junio C Hamano wrote: > Konstantin Ryabitsev <konstantin@xxxxxxxxxxxxxxxxxxx> 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. Yes, those last two should be: A---B---C---M topic / / X---Y------------ \ master And: A---C---B---M topic / / X---Y----------- \ master I.e. you could re-arrange it so that it's: C---B---A---M topic / / X---Y----------- \ master Or whatever, sorry about that mix-up.