Version Control

merge conflict

A merge conflict happens when two branches changed the very same lines of a file in different ways, and git can't tell which version you want. Rather than guess and risk picking wrong, it stops and hands the decision to you. It's not a failure — it's git being honest about a choice only a human can make.

Git marks the clash right inside the file with three lines you'll learn to recognise: <<<<<<< opens your side, ======= divides the two versions, and >>>>>>> closes the incoming side. Everything between the first marker and ======= is your branch's version; everything between ======= and the last marker is theirs.

Resolving it is calm work: open the file, decide what the final lines should actually say — keep yours, keep theirs, or blend the two — then delete all three marker lines so what's left reads like normal code. Save, stage the file, and finish the merge. The markers must be gone; if any remain, you haven't resolved it yet.

<<<<<<< HEAD
greeting = "Hello"
=======
greeting = "Hi there"
>>>>>>> fix-login

The two versions of one line: yours above =======, theirs below. Pick one, delete all three markers.

Conflicts feel scary the first time and ordinary by the tenth. The fix is always the same: edit the file until it's right, remove the markers, done.

Also called
conflictmerge conflict markersconflict markers
See also