There has been some interest / questions about resolving merge conflicts on GitHub. This happens when two pull requests (PR) change the same part of a file in different ways. We have an example of such a PR here, so I’ll walk through the steps I’m taking to resolve the conflict.

There are GUI tools that make this easier to understand, but basically: there are two different versions of this file, and this interface is asking me which one is correct.

In between the <<<<<<< and ======= markers, there is this line:

This corresponds to my PR: “This line was left in your PR”.

But, in between ======= and >>>>>>>, there is nothing: “This line was deleted in the `master` branch”.

This is because I deleted the line *below* that one in my PR, and in another PR the line that has the conflict was also deleted. So, in this case, the way to resolve the conflict is to delete that entire section

The next conflict is similar: I removed this whole section in this PR, but it was modified elsewhere. Since I still want to remove it, I’ll resolve the conflict by just removing that whole section.

Last one! In this case, this section was _modified_ in two different PRs, and I need to decide what the final version should be after all these changes.

After resolving all conflicts, you get a “Commit merge” button, which adds a new commit to the PR:

All done, now just waiting for the automated tests to make sure I didn’t break anything 😉

Notable Replies

  1. klein says:

    Hello, some context for the sudden appearance of this thread. This was an old tutorial written by @scott on that didn’t have a thread linked to it. Since we are now making more tutorials and have a place to collect them, I decided to add this tutorial to our growing category here on the forum. Hope it is useful.

Continue the discussion at