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
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
text
<<<<<<< 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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026