Home·Error messages

git · Git

The message

CONFLICT (content): Merge conflict in src/app.tsx

What it means

Both sides changed the same lines differently and git cannot decide which is right, so it wrote both versions into the file between <<<<<<<, ======= and >>>>>>> and stopped. It happens when you and someone else edited the same region, or when a rebase carries your commit across an edit of those lines. Open the file, make it what it should be, delete the markers, then git add it and commit. git merge --abort returns you exactly to the state before the merge, which is safe for anything already committed but throws away the conflict resolutions you had done by hand.

The fix

git merge --abort
Printed by
git
Git
29

Almost every git error is a refusal that means "doing that from this state would lose something"; fatal: means git stopped without changing anything, and the hint: lines under the first line usually carry the actual remedy.

Reading an error message

  • Read from the first line down. The lower you go the more it is about the tool’s internals; the cause is usually at the top.
  • If there is a file and a line number, start there — not the top stack frame, but the topmost line that names a file you wrote.
  • Search the message verbatim, but strip your own paths and variable names first; those are what stop the search from matching.
  • The same condition is worded differently across tool versions. If results look wrong, add the version number to the query.
  • Before pasting a fix, check what it throws away. Some of these cannot be undone.

Common questions

Q. What does “CONFLICT (content): Merge conflict in src/app.tsx” mean?

Both sides changed the same lines differently and git cannot decide which is right, so it wrote both versions into the file between <<<<<<<, ======= and >>>>>>> and stopped. It happens when you and someone else edited the same region, or when a rebase carries your commit across an edit of those lines. Open the file, make it what it should be, delete the markers, then git add it and commit. git merge --abort returns you exactly to the state before the merge, which is safe for anything already committed but throws away the conflict resolutions you had done by hand.

Q. How do I fix it?

git merge --abort — before running it, check the explanation above for what this command discards.

Q. Which tool prints this?

git. It sits under Git, and the message runs to 6 words.

Errors nearby