Squash two merge commits into one merge commit

Viewed 27

I have a situation where I want to squash two merge commits into one. Each merge commit contains conflict resolutions and thus git rebase cannot be used to my understanding. There is an option --rebase-merges, but I haven't figured out how it can be utilized.

The state:

A--\       <- feature
B--m1--\   <- branch from older master
B----C-m2  <- branch from newer master

The desired state:

A------\  <- feature
B----C--m <- branch from newer master

Redoing the merge of the feature branch into the newer master is not the option, since the work, which was done in m1 will need to be repeated.

The reason for the state is that while the first merge m1 is under review another work C, which conflicts with m1, was merged.

Any suggestions merging two merge commits into one can be performed?

0 Answers
Related