How to Resolve a Merge Conflict in Git

A merge conflict happens when Git can't automatically combine changes because the same lines were edited differently on both sides being merged.

Published September 29, 2026

A merge conflict happens when Git can't automatically combine changes because the same lines were edited differently on both sides being merged.

Key points

  • Git marks conflicting sections in the file with <<<<<<<, =======, and >>>>>>> markers showing both versions
  • Edit the file to keep the correct content, removing the conflict markers entirely
  • Stage the resolved file with git add, then complete the merge with git commit (or git rebase --continue during a rebase)

Example

<<<<<<< HEAD
your changes
=======
their changes
>>>>>>> branch-name
More Git articles