Skip to content

Instantly share code, notes, and snippets.

@bgveenstra
Last active April 10, 2017 20:17
Show Gist options
  • Save bgveenstra/0cc352439ccab5abade7a450cc6f781b to your computer and use it in GitHub Desktop.
Save bgveenstra/0cc352439ccab5abade7a450cc6f781b to your computer and use it in GitHub Desktop.

Resolve Merge Conflicts On GitHub


1. Start on the pull request "conversation" tab.

pull request conversation tab


2. Scroll down to the message that says "This branch has conflicts that must be resolved" or "Cannot automatically merge".

resolve conflict button


3. Click the "resolve conflicts" button.

github resolve conflicts gui

This interface shows the files that have conflicts on the left and the content of those files on the right.


4. For each file that has a conflict:
  1. Compare the portion(s) of the file that start with <<<<<<< suggestions to the portion(s) right below that end with >>>>>> master. The suggestions portions are code from the branch you're bringing in, and the master portions are the current code.

  2. Edit the file to contain the code as you want it. Keep any parts you want, and remove any parts you want. Also remove the lines with <<<<, >>>>, and ===== (merge junk). (This is the annoying hand work piece.)

  3. When the file is updated to the version you want to keep, click the "mark resolved" button on the top right.

mark resolved bar


5. Once you've marked all the files as resolved, you should be able to merge the pull request through GitHub without conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment