Skip to content

Instantly share code, notes, and snippets.

@iolloyd
Last active August 29, 2015 14:15
Show Gist options
  • Save iolloyd/3a3661f39c1d2b5d8ed3 to your computer and use it in GitHub Desktop.
Save iolloyd/3a3661f39c1d2b5d8ed3 to your computer and use it in GitHub Desktop.
Method to resolve large conflicting merges

When resolving conflicts using rebase it can be tedious having to apply the same fixes again. Turn on rerere forever.

git config --global rerere.enabled true

Now turn on diff3 conflict style resolution, forever.

git config --global merge.conflictstyle diff3

Now, to the fix ...

Make a copy of the branch to merge into.

git checkout -b mycopy

git rebase branch-i-want

Fix conflicts as they come up.

git rebase --continue

Rinse and repeat until all conflicts are gone.

git checkout original_branch

git merge branch-i-want

Hopefully rerere has saved the day completely. If not, get the correct file versions from mycopy branch.

git checkout mycopy -- file-i-want

git commit -m 'so cool'

Clean up

git branch -d mycopy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment