Skip to content
Branching and merging

Conflicts

Not an error. A question git cannot answer for you.

A conflict happens only when both sides changed the same region differently. Everything else merges silently — most merges have no conflict at all.

When one does, git puts both versions in the file between markers, and puts three versions in the index: stage 1 is the common ancestor, stage 2 is yours, stage 3 is theirs. `git status` reads those stages to tell you what kind of conflict it is.

Resolving means editing the file, removing the markers, and staging it — staging is how you tell git the answer. `git merge --abort` puts everything back exactly as it was, at any point before you commit.

Commands in this lesson

git merge --abort
Undo a conflicted merge, restoring the state you started from
git add
Copy the current contents of a file into the index
git status
Report the two gaps: HEAD against the index, and the index against your files
No account, no backend. Everything you do stays in this browser.liter8.sh