GitHub says “This branch has conflicts that must be resolved” when your branch and the base branch changed the same lines, or one side edited a file the other deleted. The Merge pull request button stays off until the conflict is fixed. If the conflict is a simple line change, click Resolve conflicts on the pull request, pick the code you want, then Mark as resolved and Commit merge. If that button is greyed out, resolve it locally: merge the base branch into yours, or rebase onto it, fix the files, and push.
How do I resolve conflicts in GitHub’s web editor?
Per GitHub’s docs on resolving a merge conflict on GitHub:
- Open the pull request and click Resolve conflicts near the bottom.
- For each conflict, keep one side, the other, or write something new, and delete the
<<<<<<<,=======and>>>>>>>markers. - Click Mark as resolved on each file, then Commit merge.
- If your head branch is protected, GitHub asks you to create a new branch for the resolution and update the pull request.
That commit is a merge of the base branch into your branch. If your team keeps a linear history with rebases, the web editor is the wrong tool even for a one-line conflict.
Why can’t I resolve the conflict in the web editor?
The browser editor only takes simple competing line changes. Anything else, such as a file one branch modified and the other removed, greys out Resolve conflicts, and the merge conflicts reference says to resolve it in a local clone and push it back to the pull request branch. Update branch won’t help either, since it only works when there are no conflicts.
Should I merge or rebase to resolve conflicts locally?
I merge by default, and always when other people push to the branch:
git fetch origin
git checkout my-branch
git merge origin/main
# fix the files git status lists as "both modified"
git add .
git commit
git pushFor a file deleted on one side, git status shows it as deleted. Run git add on it to keep it or git rm to drop it, as the command line guide shows.
Rebase when the branch is yours alone and you want a linear history. Run git rebase origin/main, fix each conflict as it stops, git add the file, and run git rebase --continue. git rebase --abort puts the branch back the way it was, per GitHub’s rebase conflict docs. A rebase rewrites commits you already pushed, which GitHub calls bad practice on shared history, and you will need git push --force-with-lease to update the pull request. The same trade-off shows up when your branch is only out of date.
Either way, a long-lived branch will keep conflicting as the base moves. Small pull requests that merge quickly conflict less.
How should reviewers re-review after a conflict resolution?
A resolution can drop someone’s change without anyone noticing, or keep both sides when only one was right, and that code was never in the diff you approved. I check:
- Only the conflicted files. The pull request diff compares against the merge base, so merging main in doesn’t flood Files changed with other people’s work, per GitHub’s three-dot diff docs. GitHub also unmarks a viewed file when it changes after you viewed it.
- The merge commit itself, if the author merged. Ask them which files conflicted and how they chose.
- Old head versus new head, if the author rebased. Every commit is new, so compare the two versions of the branch instead of re-reading everything. That’s an interdiff, and re-reviewing with one saves a full second review.
- The checks, rerun on the new head commit. A clean textual merge can still break the build.
Branch protection can enforce the second look. With Dismiss stale pull request approvals when new commits are pushed, GitHub dismisses an approval when a push changes the diff, and the protected branches docs say approvals also go stale if the merge base introduces new changes. If a reviewer resolved the conflict themselves, the last pusher rule means someone else has to approve.
In Pyor, viewed state syncs with GitHub and a file stays viewed until its content changes, so after a resolution the unviewed files are your reading list.
Frequently asked questions
Why is the Resolve conflicts button greyed out on GitHub?
The web editor only handles simple competing line changes. For anything else, such as a file one branch edited and the other deleted, GitHub deactivates Resolve conflicts and its docs say to use another Git client or the command line.
Does resolving conflicts on GitHub merge main into my branch?
Yes. GitHub warns that resolving conflicts on GitHub merges the entire base branch into the head branch. If the head branch is protected, you have to create a new branch for the resolution.
Do I need a new approval after resolving a merge conflict?
It depends on branch protection. With Dismiss stale pull request approvals when new commits are pushed turned on, GitHub dismisses approvals when a push changes the diff, and the pull request cannot merge until someone approves again. Without it, earlier approvals stay, so ask for a look at the conflicted files anyway.