Skip to content

Resolving conflicts

Ben Auer edited this page Oct 8, 2019 · 10 revisions

Sometimes when you do a pull request you will get a "This branch has conflicts that must be resolved" error. In order to merge this pull request you must do a series of steps on the command line. Sometimes it will tell you what to do but sometimes it does not. Suppose we want to merge branch feature/X into develop but it says there are conflicts. Here is what you do. If you could see the instructions it would say this:

Step 1: From your project repository, bring in the changes and test.

git fetch origin

git checkout -b feature/X

git merge develop

At this point the merge will fail because of the conflicts. Fix the conflicts and add the conflicting files to complete the merge. Then go on.

Step 2: Merge the changes and update on GitHub.

git checkout develop

git merge --no-ff feature/X

git push origin develop

Notice you can't do this last step because develop is a protected branch. At this point you need to create a new branch and create a pull request with that.

So instead

git checkout -b feature/hand_merge_X

push this to git and issue a pull request for this branch.

Clone this wiki locally