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 conflicts

Why This Happens

  1. 1.Parallel changes to same file
  2. 2.Branches diverged
  3. 3.Force push overwrote changes
  4. 4.Rebase created conflicts

Step 1: Check Conflict Files

bash
gh pr view <pr-number>
git status
git diff --name-only --diff-filter=U

Step 2: View Conflicts

bash
# In GitHub UI, click "Resolve conflicts"
# Or locally:
git checkout feature-branch
git fetch origin
git merge origin/main

Step 3: Identify Conflict Markers

bash
<<<<<<< HEAD
Current branch changes
=======
Incoming branch changes
>>>>>>> feature-branch

Step 4: Resolve Conflicts Manually

bash
vim conflicted-file.txt
# Remove markers
# Keep desired changes
# Save file

Step 5: Use Merge Tool

bash
git mergetool
# Or VS Code:
git config --global merge.tool code

Step 6: Stage Resolved Files

bash
git add resolved-file.txt
git status

Step 7: Complete Merge

bash
git commit
# Or continue rebase:
git rebase --continue

Step 8: Push Resolution

bash
git push origin feature-branch
# Or if rebased:
git push --force-with-lease

Step 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/main
  • [Fix Git Merge Conflict Not Resolving](/articles/fix-git-merge-conflict-not-resolving)
  • [Fix Git Cherry Pick Conflict](/articles/fix-git-cherry-pick-conflict)