Skip to content

Unmerged Files

Error message

                error: commit is not possible because you have unmerged files
              

Quick summary

A merge or rebase is in progress with unresolved conflicts — you must resolve them before committing.

Why this happens

  • A merge conflict was not fully resolved before committing

  • You staged some but not all conflicted files

  • A rebase paused on conflicts and you have not finished resolving

Minimal example

✗ Broken code
git commit -m "Merge"  # error: you have unmerged files
✓ Fixed code
# Resolve conflicts in the file
# Edit file to remove <<<<<<<, =======, >>>>>>> markers
git add conflicted-file.txt
git commit -m "Merge: resolve conflict"

You must resolve all conflicts (remove markers, choose correct version) and git add each file before committing.

How to diagnose

  • Run git status to see which files still have conflicts

  • Open conflicted files and look for <<<<<<<, =======, >>>>>>> markers

  • Run git diff to see unresolved conflict details

How to fix

  • Edit each conflicted file to choose the correct version and remove markers

  • Run git add <file> for each resolved file

  • Run git commit to complete the merge, or git rebase --continue for a rebase

  • To abort: git merge --abort or git rebase --abort

How to prevent

  • Always resolve all conflicts before committing

  • Use git status to verify no files have conflicts before committing

Related Resources

Related Glossary

Related Lessons

← Back to language