Lesson 3 of 5
Merge and conflicts
Merging (git merge) brings two branches together. When they changed different things, Git combines everything automatically.
A conflict happens when both branches change the SAME thing differently: Git cannot choose. We detect it by comparing values key by key.
# same key, same value -> nothing to do # key missing on one side -> add it # same key, different values -> CONFLICT
🎯 Exercise
Merge feature into main. Start from merged = dict(main). Go through each key/value of feature: key missing in main → add it to merged; same value → do nothing; different value → add the key name to the conflicts list. Print the number of conflicts.
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →