After forking a Github repository I performed some changes in it. This was quite some time back, now the upstream branch is well ahead. Thus I wanted to merge those remote changes into my forked repo.
I hit upon a merge conflict in one file only. I went ahead and ran vimdiff
as the mergetool
to sort these things out.
I only want to merge in the remote changes and discard the local ones.
But there are too many conflicting hunks in that file. Selecting changes to merge one by one is tedious to say the least.
:diffget RE
on all the conflicts in that file?Merging in git has two options that can default to using remote changes (theirs) or local changes (ours).
If you want to resolve conflicts only to the remote changes in a merge you would do the following:
git merge -Xtheirs <branch>
If you want to resolve conflicts only to the local changes in a merge you would do the following:
git merge -Xours <branch>
You can find more about advance merging strategies from the git advanced merging documentation.