Git can often resolve differences between merged branches. Usually, the changes are on different lines, or even in different files, which makes the merge simple for computers to understand. However, sometimes there are competing changes that Git needs your help with to decide which changes to incorporate in the final merge. Often, merge conflicts happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file. You must resolve the conflict before you can merge the branches.

If you have a merge conflict between your compare branch and base branch on GitHub, you can view the files with conflicting changes above the Merge pull request button, which will be deactivated.

merge conflict error message

You cannot merge your pull request branch on GitHub until you resolve the merge conflict. To resolve the merge conflict, you must manually select the changes that you want to keep in the final merge on the command line or on GitHub.

You can only resolve the merge conflict on GitHub, if your merge conflict is caused by competing line changes, such as when people make different changes to the same line of the same file on different branches in your Git repository. For all other merge conflicts, you must resolve the merge conflict locally on the command line.

If you have a merge conflict on the command line, you cannot push your local changes to GitHub until you resolve the merge conflict locally on your computer. If you try merging branches on the command line that have a merge conflict, you'll get an error message.

git merge BRANCH-NAME
Auto-merging styleguide.md
CONFLICT (content): Merge conflict in styleguide.md
Automatic merge failed; fix conflicts and then commit the result

Further reading