Alternative title: How to squash merge commits?
I have the following state in my local repository:
C (origin/feature)
/
A - B - m (feature)
/
Y - Z (master)
I've just merged changes from one branch to another (e.g. from master into our feature branch, or even vice versa). When I did this, commit B and Z were the most latest commits in their respective branches.
However! Dastardly Dan just pushed his change to the branch I was merging into (C). When I now try and push, I can't. I first have to fetch the changes and merge them somehow. The question is: how?
If I do a pull with rebase, I end up having to resolve all the conflicts in the merge between B & Z. If I try to merge, I end up with two merge commits, which isn't that clean, and also shouldn't be that necessary.
C --
/ \
A - B - m - m2
/
Y - Z
Is there any way of squashing m and m2 such that it looks like:
C --
/ \
A - B -- m3
/
Y - Z
An interactive rebase obviously doesn't show the merge commits, and a cherry-pick requires me to resolve all the merge conflicts again (between B & Z, which weren't affected by C at all).