Skip to content

Instantly share code, notes, and snippets.

@mwj8410
Last active March 31, 2017 15:07
Show Gist options
  • Save mwj8410/437eb79b893eb0ca4739b8b29334922e to your computer and use it in GitHub Desktop.
Save mwj8410/437eb79b893eb0ca4739b8b29334922e to your computer and use it in GitHub Desktop.

This assumes that this is a simple merge conflict where the same files are changed in both branches

This is most common when using merge commits in the working branch and attempting to rebase that branch into a target branch. The solution is to either do a merge commit into the target branch, or to reqrite the history of the working copy as follows:

git checkout development
git pull
git checkout <feature branch>
git pull
git rev-list --count HEAD ^development    // Provides the  number of commits in the branch not in development

git reset --soft HEAD~1                   // Replace the 1 with the number from previous command
git add .
git status                                // Verify that changes are staged correctly
git commit -m "<full message>"
git rebase development
git mergetool                             // Will open your registered mergetool
git rebase --continue

                                          // Once all is good
git push --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment