After finishing working on a topic branch, I merged the topic branch into master like following:
o---*---o---o topic
/ \
o---o---o---*---o---o---+ master
The commits marked with '*' modified the same code, hence merging lead to merge conflicts that were resolved in the merge commit (marked with '+').
While I merged and resolved the conflicts, my colleague pushed new commits to master (marked as 'n'), resulting in following history:
o---*---o---o topic
/ \
o---o---o---*---o---o---+ master
\
n---n origin/master
Now, pushing my local master branch of course leads to an error, as it's no fast-forward-push, so I have two choices:
Throw away my work, reset master to origin/master and redo the merge. I'd like to avoid that as I'd have to resolve the conflicts all over again.
Rebase master onto origin/master and push. Here comes my problem: doing this rebase (even when using the
-p
switch) does not work smoothly, the merge commit shows the same conflicts again, even though the new commits ('n') didn't change anything touched by the topic branch. So I'd have to resolve the conflicts again during the rebase and would have the same result as with option 1.
What I'd like to achieve is rebasing the merge commit '+' without having to resolve the conflicts again:
o---*---o---o-------- topic
/ \
o---o---o---*---o---o---n---n---+ master & origin/master
Edit:
The rerere switch is enabled but didn't seem to help in any way; do I have to do anything more than setting config.rerere to true to fix my problem?
Edit 2:
Merging the merge-commit ('+') to origin/master would also work (as proposed in the comments and an answer) but would lead to a kind of ugly history which I'd like to avoid by having one merge commit only.