⇦ Back to: Update Pull Request | ⇧ Overview

Resolving merge conflicts

Git can handle many merges automatically, even if they affect the same file, as long as they don’t modify the same line in different (incompatible) ways. If it can’t then it’s up to you.

<aside> 💡 Resolving merge conflicts involves manually specifying what the result combining multiple commits affecting the same line(s).

</aside>

To handle the merge conflicts you need to:

Locating merge conflicts

Using GitHub Desktop and an editor like VSCode

You see a warning about a merge conflict when merging branches, like this:

https://user-images.githubusercontent.com/2803227/194439101-710c075e-4662-4be4-bf97-d03096803863.png

Depending on whether you have a compatible editor installed, GitHub desktop may offer to open the conflict in the editor. Click on that.

If you click on the button, the editor shows the each of the (groups of) conflicting lines like this:

https://user-images.githubusercontent.com/2803227/194439362-d6f58961-7a8e-4101-ba9e-1ad22c4d60a5.png

Using GitHub

In the PR, if there are conflicts with the base branch, you may see a dialog like this:

https://user-images.githubusercontent.com/2803227/194440335-f1607acb-efed-47a5-9923-66b257006d3f.png

Click on the button to see the merge conflict, each of which will look something like this:

https://user-images.githubusercontent.com/2803227/194440382-4a890a35-c52c-413f-9da8-9f40a865eb9d.png