๐ŸŽ“ A1Learner
๐Ÿ”
0 of 50 lessons completed

What Is a Conflict

A conflict is a change Git cannot join on its own. Two branches changed the same line in different ways.

Try the merge

Both branches changed the milk line. Git stops and asks.

$ git merge price-check

See the markers

The top half is your line. The bottom half is theirs.

$ cat notes.txt

Example

$ git merge price-check
$ git status

Key points

  • Git joins changes on different lines by itself.
  • The same line changed twice is a choice, not a merge.
  • Git stops the merge and asks you to choose.
  • The file holds both versions with markers.
  • The markers show where your line ends and theirs begins.
  • Status lists the file under unmerged paths.
  • Nothing is lost. Both versions wait in the file.

Here, the merge stops halfway. Status names the file as both modified. The choice is yours to make.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

When does Git stop a merge?