I have something akin to the following history (but more complicated with several merges):
F - G - H - K - L - …
/ /
/ I - J - M - …
/ /
A - B - C - D - E - …
A′- B′- C′- D′- E′
A and A′ are identical trees with different histories.
I want to rebase all branch commits to equivalent commits on the prime branch, preserving merges (presumably by manually specifying the hashes of where the equivalent commits are on the rebased tree). How do I tell K′
that it needs to merge from H′
and J′
? Or do I have to recreate these merge commits manually?
If I do git rebase -p --onto B′ B L
it fails to apply cleanly. I could rebase H
onto B′
and M
onto D′
, and then recreate merge K
myself, then rebase L
onto K′
(and so on for other branches/merges not shown) but it would be a fair bit of work.
I have looked at several other questions but none of them featured merges.