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.
Merge conflictCONFLICT (content)Automatic merge failed; fix conflicts and then commit the resultyou need to resolve your current index first 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
git statusto list conflicted files- Edit each file, remove markers, keep the right code
git add <file>thengit commit(merge) orgit rebase --continue- Abort if needed:
git merge --abort/git rebase --abort
Detailed fix by platform
Git
- Take one side for a whole file:
git checkout --ours fileor--theirs file(note: during rebase “ours” is the branch you’re rebasing onto). - Normalize line endings with
.gitattributes(* text=auto) to avoid whole-file conflicts.
Code examples
Conflict markers
<<<<<<< HEAD
const timeout = 30;
=======
const timeout = 60;
>>>>>>> feature/retryHow to diagnose
- Files — git status — which files?
- Intent — Which change should win, or a combination?
- Tests — Run tests after resolving
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Git
Other ways to find it
Where this error sits
Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026