Git Merge Conflict: Find, Fix, and Complete the Merge
This error matches known, documented patterns with reliable solutions.
Quick Fix (Most Common Solution)
- Run git status to see which files have conflicts (listed under "both modified")
- Open each conflicting file and locate the conflict markers: <<<<<<, =======, >>>>>>>
Seeing "CONFLICT (content): Merge conflict in"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.
What This Error Means
Git cannot automatically merge two branches because both changed the same lines in the same file. Git marks the conflicting sections with special markers and pauses the merge, requiring you to manually choose which version to keep.
Frequently documented in developer and vendor support forums.
Not affiliated with browser, OS, or device manufacturers.
New here? Learn why exact error messages matter →
Common Causes
- Two branches both modified the same lines in the same file
- A file was deleted on one branch and modified on another
- Rebasing a long-running feature branch that diverged significantly from main
How to Fix
- Run git status to see which files have conflicts (listed under "both modified")
- Open each conflicting file and locate the conflict markers: <<<<<<, =======, >>>>>>>
- Edit the file — remove the markers and keep (or combine) the correct content
- Stage each resolved file: git add [filename]
- Complete the merge: git commit (Git pre-fills the merge commit message)
Last reviewed: June 2026 How we review solutions
Didn't fix it? Get a personalised solution
Environment-Specific Commands
Standard conflict resolution
git status# Open each file listed under "both modified"# Edit: remove <<<<<<, =======, >>>>>>> markersgit add [resolved-filename]git commit
Abort the merge and try again later
git merge --abort# All conflict changes are discardedgit status
Quick Diagnostic Path
- If git status shows 'both modified' files → Open each file, find <<<<<< markers, edit to resolve, then git add the file
- If git status shows 'deleted by us' or 'deleted by them' → Use 'git rm [file]' to confirm deletion or 'git add [file]' to keep it
- If A text editor opens with a commit message → Save and close the editor to complete the merge commit
If This Still Fails, Check
- Binary file conflicts (images, compiled assets): git cannot show markers. Choose a version explicitly: git checkout --ours [file] or git checkout --theirs [file]
- Many conflicts from a long-running branch: consider rebasing incrementally — git rebase main in small steps rather than one large merge
- VS Code shows Accept Current / Incoming / Both buttons inline — clicking these automatically edits the file and removes conflict markers
Find conflicts and complete the merge
# After git merge produces conflicts:
# 1. See which files conflict
git status
# A conflicting file will contain:
# <<<<<<< HEAD
# your version of the code
# =======
# the incoming branch version
# >>>>>>> feature-branch
# 2. Edit each file — remove markers, keep correct code
# 3. Stage the resolved file
git add [filename]
# 4. Complete the merge
git commit
# 5. Verify no conflicts remain
git statusEdge Cases
Large File Storage and Hook Failures Causing Merge Conflict How To Resolve
Merge Conflict How To Resolve that developers overlook when the error message points to a different root cause.
Git hooks run automatically on operations like commit, push, and merge. If a pre-push hook fails (due to a missing test runner, lint failure, or network check), Git aborts the operation and surfaces the hook's exit code as the error — which may be reported similarly to Merge Conflict How To Resolve. To bypass hooks temporarily for testing, use git push --no-verify. For Git LFS issues: LFS must be initialized on every machine that clones the repository. Run git lfs install once per machine, then git lfs pull to download large files. If LFS is not installed, git checkout or git pull may fail with errors resembling Merge Conflict How To Resolve when trying to materialize LFS pointer files. Verify LFS status with git lfs status and check tracked patterns with git lfs track.Optional follow-up
Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.
Was this explanation helpful?
Frequently Asked Questions
What do the conflict markers mean?
<<<<<<< HEAD is your current branch's version. >>>>>>> branch-name is the incoming version. ======= separates them. Delete all three markers and keep (or merge) the code you want.
Can I abort the merge and start over?
Yes — run 'git merge --abort' to stop the merge and return to exactly the state before you ran git merge.
Which editor is best for resolving conflicts?
VS Code has a built-in merge editor with 'Accept Current Change / Accept Incoming Change / Accept Both Changes' buttons that handle the markers automatically.
Related Resources
Also Known As
- Git error
- Version control error
- Git command failure
- Repository error
Common Search Variations
- "git push rejected fix"
- "git merge conflict how to resolve"
- "git error what to do"
- "git command failed"
- "fix git repository error"
- "git authentication failed solution"
Related Errors
Still Stuck?
Paste a different error message or upload a screenshot to get help instantly.