Console9

Git: CONFLICT (content): Merge conflict in file

Fix Git merge conflicts when two branches modify the same lines in a file.

Git: CONFLICT (content): Merge conflict in file

Git reports a merge conflict when two branches modify the same lines in a file and automatic merging fails.

When Git Produces This Error

Git displays CONFLICT (content): Merge conflict in {file} during git merge, git pull, git rebase, or git cherry-pick. The affected files contain conflict markers.

What Causes Merge Conflicts in Git

Two branches modified the same lines in the same file. Git cannot determine which version to keep automatically.

How to Fix Merge Conflicts in Git

  1. Open each conflicted file and look for conflict markers ( <<<<<<<, =======, >>>>>>>).

  2. Edit the file to keep the correct content and remove all conflict markers.

  3. Stage the resolved file:

    git add resolved-file.txt
  4. Complete the merge:

    git commit

For a detailed walkthrough, see How to resolve a merge conflict in Git.