What's Actually Happening
GitHub pull request cannot be merged due to conflicts. The branches have diverged and require manual resolution.
The Error You'll See
bash
This branch has conflicts that must be resolved
Use the web editor or command line to resolve conflictsWhy This Happens
- 1.Parallel changes to same file
- 2.Branches diverged
- 3.Force push overwrote changes
- 4.Rebase created conflicts
Step 1: Check Conflict Files
bash
gh pr view <pr-number>
git status
git diff --name-only --diff-filter=UStep 2: View Conflicts
bash
# In GitHub UI, click "Resolve conflicts"
# Or locally:
git checkout feature-branch
git fetch origin
git merge origin/mainStep 3: Identify Conflict Markers
bash
<<<<<<< HEAD
Current branch changes
=======
Incoming branch changes
>>>>>>> feature-branchStep 4: Resolve Conflicts Manually
bash
vim conflicted-file.txt
# Remove markers
# Keep desired changes
# Save fileStep 5: Use Merge Tool
bash
git mergetool
# Or VS Code:
git config --global merge.tool codeStep 6: Stage Resolved Files
bash
git add resolved-file.txt
git statusStep 7: Complete Merge
bash
git commit
# Or continue rebase:
git rebase --continueStep 8: Push Resolution
bash
git push origin feature-branch
# Or if rebased:
git push --force-with-leaseStep 9: Verify Merge
bash
gh pr view <pr-number>
# Click "Merge pull request"Step 10: Prevent Future Conflicts
bash
# Keep branch updated
git fetch origin
git merge origin/main
# Or rebase:
git rebase origin/mainRelated Issues
- [Fix Git Merge Conflict Not Resolving](/articles/fix-git-merge-conflict-not-resolving)
- [Fix Git Cherry Pick Conflict](/articles/fix-git-cherry-pick-conflict)