ShareYourGroupShareYourGroupError Explainer

Git: CONFLICT (content): Merge conflict in file

A plain-words explanation of this Git message: what it means, the usual causes, and the steps that fix it.

The messageCONFLICT (content): Merge conflict in f.txt

Make the error yourself

Run with git version 2.56.0.windows.4. This is the smallest example we could find that shows it.

Setup used before these commands (a practice folder with no data)
export GIT_AUTHOR_NAME=Asha GIT_AUTHOR_EMAIL=a@example.com GIT_COMMITTER_NAME=Asha GIT_COMMITTER_EMAIL=a@example.com
git init -q -b main
echo "colour: blue" > f.txt
git add f.txt
git commit -qm base
git switch -q -c feature
echo "colour: green" > f.txt
git commit -qam "feature change"
git switch -q main
echo "colour: red" > f.txt
git commit -qam "main change"

Commands

git merge feature

Git prints (the real message)

Auto-merging f.txt
CONFLICT (content): Merge conflict in f.txt
Automatic merge failed; fix conflicts and then commit the result.

Why it happens

Git can combine changes made on two branches automatically, unless both changed the same lines of the same file. Then it cannot know which version you want, so it stops, marks the file, and waits for you. In the example main changed the line to red and feature changed it to green. The message names each file with a conflict, and says "Automatic merge failed; fix conflicts and then commit the result."

Open the file: Git has inserted markers where the two versions meet. The lines between <<<<<<< and ======= are yours (the current branch) and the lines between ======= and >>>>>>> come from the other branch.

How to fix it

  1. Run git status to see the list of files with conflicts.
  2. Open each file, decide what the text should be, and delete the three marker lines (<<<<<<<, =======, >>>>>>>) and the version you do not want.
  3. Save the file, then git add <file>.
  4. When all files are done, run git commit (or git merge --continue).
  5. If you want to go back to before the merge, git merge --abort puts everything back.
  6. Many editors and tools show the two sides next to each other and let you choose with one click.

The corrected version

Commands

git merge feature
echo "colour: green" > f.txt
git add f.txt
git commit -m "Merge feature"

Git prints (the corrected version)

Auto-merging f.txt
CONFLICT (content): Merge conflict in f.txt
Automatic merge failed; fix conflicts and then commit the result.
[main d654a1a] Merge feature

How to avoid it

Pull often, make small commits, and agree who works on which files. Conflicts are normal, and short-lived branches have fewer of them.

Questions

How do I take one whole side without editing?

git checkout --ours file keeps your version and git checkout --theirs file takes the other branch's version, then git add file.

This is an independent guide. It is not connected with Python, Microsoft, Google, GitHub or the Git project. Product names belong to their owners. Examples were run on 13 November 2026 in a practice folder or a blank workbook; your version may word a message slightly differently.