sreenivas./courses
Git & GitHub for Beginners — all lessons
⚡

MODULE 02 · 6 MIN READ

Manufacture a conflict — on purpose

Now the moment people fear. Let's kill the fear by causing a conflict deliberately: two universes will edit the same file in different ways, then we merge.

git bash

$ git switch -c version-a

$ edit notes.txt

$ git commit -am "Vote tea"

$ git switch main

$ edit notes.txt

$ git commit -am "Vote coffee"

$ git merge version-a

CONFLICT (content): Merge conflict in notes.txt

Automatic merge failed; fix conflicts and then commit the result.

COMMIT GRAPH · on branch main

a1b2cmain ← HEAD
practice terminal — you cannot break it

a tiny simulated laptop — your Day 1 repo is preloaded.

$ 

// try: git switch -c version-a → edit notes.txt → git commit -am "Vote tea" → git switch main → edit notes.txt → git commit -am "Vote coffee" → git merge version-a