In a git repository, I have a branch in which I have regularly merged the master branch:
A -- B -- C -- D -- E -- F -- G (master)
\ \ \
U -- V -- M1-- X -- Y -- M2 -- Z (feature)
Where the M1 and M2 commits merge master into feature.
I would like to squash the consecutive commits U and V and preserve the rest of the structure.
Intuitively, it should be possible to do this without having to solve the merge conflicts in M1 and M2 again, because by squashing U and V together I do not change the states of the working trees being merged by M1, nor the merge base.
However, if I do this with git rebase -i A --rebase-merges (with pick U followed by fixup V) I need to solve the merge conflicts of M1 again.
Is there a way to instruct Git to re-use M1 and the following commits as-is?