CONFLICT 🌿 Git

Git: CONFLICT (content): Merge conflict in file — Automatic merge failed

Both branches changed the same lines; Git needs you to choose the final content before completing the merge/rebase.

Seen on: Git

Meaning

Git inserts conflict markers (<<<<<<<, =======, >>>>>>>) into the file. You edit the file to the desired result, remove the markers, stage it and continue.

Common causes

  • Same lines edited on both branches
  • One branch deleted a file the other modified
  • Formatting/line-ending changes across the file

⚡ Quick fix

  1. git status to list conflicted files
  2. Edit each file, remove markers, keep the right code
  3. git add <file> then git commit (merge) or git rebase --continue
  4. Abort if needed: git merge --abort / git rebase --abort

Detailed fix by platform

Git

  1. Take one side for a whole file: git checkout --ours file or --theirs file (note: during rebase “ours” is the branch you’re rebasing onto).
  2. Normalize line endings with .gitattributes (* text=auto) to avoid whole-file conflicts.

Code examples

Conflict markers

text
<<<<<<< HEAD
const timeout = 30;
=======
const timeout = 60;
>>>>>>> feature/retry

How to diagnose

  1. Files — git status — which files?
  2. Intent — Which change should win, or a combination?
  3. Tests — Run tests after resolving

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.