“This branch has conflicts that must be resolved” means your pull request and its base branch changed the same part of a file in different ways, so GitHub cannot merge them automatically. Resolve the conflict in GitHub’s web editor or on the command line, push the result, and the merge button becomes available again.
Why GitHub shows it
Git merges most changes on its own. It stops when it cannot safely choose a version. GitHub’s documentation gives the two usual causes: people make different changes to the same line of the same file, or one person edits a file that another deletes. While the conflict stands, the Merge pull request button is deactivated. See GitHub’s guide to merge conflicts.
It often appears on a pull request that was fine when you opened it. Another pull request landed first and moved the base branch.
Read the conflict markers
Git marks each conflict in the file. When you merge main into your branch, the first block is your branch’s version and the second is the version from main:
<<<<<<< HEAD
const timeout = 30;
=======
const timeout = 45;
>>>>>>> origin/mainResolving means replacing the whole block with the final content. That can be one side, the other, or a combination of both. Then delete the three marker lines. Choosing a side without reading the surrounding code is how a resolved conflict becomes a bug.
Fix it in the web editor
- In the pull request, select Resolve conflicts.
- For each file, edit the text between the
<<<<<<<,=======and>>>>>>>markers so only the final content remains, and delete the markers. - Select Mark as resolved for each file, then Commit merge.
The web editor handles simple line conflicts. For anything else, GitHub asks you to use the command line.
Fix it on the command line
git fetch origin
git checkout my-branch
git merge origin/main
# edit the conflicted files and remove the markers
git add .
git commit
git pushIf your team rebases instead of merging, run git rebase origin/main, fix each conflict as the rebase stops, git add the files, and continue with git rebase --continue. Then push with git push --force-with-lease.
Merge or rebase?
Both bring your branch up to date with the base branch. Merging adds one merge commit and leaves your existing commits alone, so it is safe on a branch other people have pulled. Rebasing replays your commits on top of the base branch for a straight history, but it rewrites them, so you resolve conflicts commit by commit and have to force-push. If your team has no rule, merge the base branch in: it is one round of conflicts and nothing is rewritten.
Fix it with a coding agent
Coding agents resolve conflicts well when they can see both sides. Ask the agent to merge the base branch into the pull request branch, resolve the conflicts so that both changes survive, and run the tests. On GitHub, Copilot can also help resolve conflicts from the merge box when it is enabled for the repository.
The conflicts GitHub does not show
This message only covers changes to the same lines. Two pull requests can change different files and still not work together: one renames a function while another adds a call to its old name. GitHub shows no message, the merge is clean, and main breaks afterwards. These are semantic conflicts, and they are found by testing or analyzing the combined code, not by Git. See why a clean merge can still break main.
If you see this message every day
One conflict is routine. Seeing the message on most pull requests means work is arriving faster than it lands: each merge moves main and puts every other open pull request behind it. Teams running coding agents in parallel feel this most.
- Keep pull requests small and short-lived.
- Turn on
git rererewithgit config rerere.enabled true, so Git reuses a resolution you have already made. - Use a merge queue so pull requests are ordered and tested together.
Most merge queues remove a pull request that conflicts, and you are back at this message. Merget is a semantic merge queue that resolves the conflict in queue order instead, including conflicts Git merges cleanly that still break the build. Compare merge queues.
Questions
What does “This branch has conflicts that must be resolved” mean?
Your pull request and its base branch contain competing changes that Git cannot combine automatically. GitHub blocks the merge until you choose the final content.
Why did the conflict appear after I opened the pull request?
Another pull request merged into the base branch and changed the same lines. Your branch is now behind it.
Can I resolve merge conflicts on GitHub without the command line?
Yes, for simple line conflicts: use Resolve conflicts in the pull request. More complex conflicts need a local clone.
How do I stop getting merge conflicts?
Keep pull requests small, merge often, and use a merge queue. With many parallel pull requests, a queue that resolves conflicts removes most of the manual work.
See how Merget resolves conflicts in queue order, or sign up free and connect one repository.