On 08/03/2018 21:27, Igor Djordjevic wrote: > > > git merge-recursive U1' -- M U2' > > tree="$(git write-tree)" > > # in case of original merge being octopus, we would continue like: > > # git merge-recursive $tree -- M U3' > > # tree="$(git write-tree)" > > # git merge-recursive $tree -- M U4' > > # ... and so on, then finally: > > git merge-recursive $tree -- "$(git merge-base U1' U2' B1')" B1' > > # in more general case, it would be: > > # git merge-recursive $tree -- "$(git merge-base <all-parents-of-new-merge-commit>)" B1' > > tree="$(git write-tree)" > > git tag M' "$(git log --pretty=%B -1 M | git commit-tree $tree -p B3' -p B4 -p B1')" > > That last line should obviously read just: > > git log --pretty=%B -1 M | git commit-tree $tree -p B3' -p B4 -p B1' > > ..., above mentioned `git tag M'` part being a leftover from my other test script. Eh, pardon me, I managed to mess up all the merge-recursive lines, too, in regards to where the merge-base commit goes... Here`s a complete (and corrected) sample: git merge-recursive M -- U1' U2' tree="$(git write-tree)" # in case of original merge being octopus, we would continue like: # git merge-recursive M -- $tree U3' # tree="$(git write-tree)" # git merge-recursive M -- $tree U4' # ... and so on, then finally: git merge-recursive "$(git merge-base U1' U2' B1')" -- $tree B1' # ... or even: # git merge-recursive "$(git merge-base B3' B4 B1')" -- $tree B1' # as in more general case, it would be: # git merge-recursive "$(git merge-base <all-parents-of-new-merge-commit>)" -- $tree B1' tree="$(git write-tree)" git log --pretty=%B -1 M | git commit-tree $tree -p B3' -p B4 -p B1'