Managing Multiple Features in Parallel

Two real features, the same shared file. Plan the merge order, then resolve the real conflict that follows anyway.

feature/vegan-notes and feature/gluten-free-notes both edit dietary-notes.md's very first line — real, independent, well-intentioned changes, made without either author knowing about the other's branch.\n\nThis is real integration risk: merging vegan-notes first is completely clean, since master has not changed yet. Merging gluten-free-notes second genuinely conflicts — not because anything went wrong, but because both branches changed the identical line in different ways. The real lesson is not "how to avoid this" (it cannot always be avoided) but "how to plan for it and resolve it calmly."

The First Merge: Genuinely Clean

git merge --no-ff feature/vegan-notes -m "Merge pull request: vegan-friendly notes"
git push

Master had not changed since this branch diverged — a clean merge, no conflict possible yet.

The Second Merge: A Real, Unavoidable Conflict

git merge --no-ff feature/gluten-free-notes -m "Merge pull request: gluten-free notes"
CONFLICT (content): Merge conflict in dietary-notes.md

Both branches touched the exact same line — master (now carrying vegan-notes' version) and gluten-free-notes genuinely disagree, and git will not guess which one wins.

Resolving It for Real

# edit dietary-notes.md to combine both real changes
git add dietary-notes.md
git commit --no-edit
git push

A real, deliberate resolution — combining both real intents rather than picking one arbitrarily and losing the other.

The Real Lesson About Merge Order

Merging vegan-notes first didn't prevent the conflict — it just meant gluten-free-notes was the one that had to resolve it. Planning merge order genuinely matters for choosing WHO does the resolving (often: whoever's change is simpler, merge first), not for avoiding the conflict outright when two branches truly touch the same line.

Integration risk

The real chance that two independently-developed branches will conflict when combined, highest when they touch the same lines of the same files. Confirmed directly in this lab: two branches editing the identical title line produced a genuine, unavoidable conflict on the second merge.

✅ Merge the First Branch Cleanly

Merge vegan-notes into master — genuinely clean, since master has not changed since it branched.

cd ~/team-recipes && git switch master
cd ~/team-recipes && git merge --no-ff feature/vegan-notes -m 'Merge pull request: vegan-friendly notes'
cd ~/team-recipes && git push
cd ~/team-recipes && cat dietary-notes.md

student@lab:~$ cd ~/team-recipes && git switch master Already on 'master' Your branch is up to date with 'origin/master'. student@lab:~$ cd ~/team-recipes && git merge --no-ff feature/vegan-notes -m 'Merge pull request: vegan-friendly notes' Merge made by the 'ort' strategy. dietary-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) student@lab:~$ cd ~/team-recipes && git push Enumerating objects: 1, done. Counting objects: 100% (1/1), done. Writing objects: 100% (1/1), 233 bytes | 46.00 KiB/s, done. Total 1 (delta 0), reused 0 (delta 0), pack-reused 0 To ../recipes-origin.git 6e4e821..ceb8b5b master -> master student@lab:~$ cd ~/team-recipes && cat dietary-notes.md Dietary Notes (Vegan-Friendly) General notes for adapting recipes.

⚡ Merge the Second: a Real Conflict

Merge gluten-free-notes, and see the genuine, unavoidable conflict this time.

cd ~/team-recipes && git merge --no-ff feature/gluten-free-notes -m 'Merge pull request: gluten-free notes'

student@lab:~$ cd ~/team-recipes && git merge --no-ff feature/gluten-free-notes -m 'Merge pull request: gluten-free notes' Auto-merging dietary-notes.md CONFLICT (content): Merge conflict in dietary-notes.md Automatic merge failed; fix conflicts and then commit the result.

🔍 Read the Real Conflict Markers

See exactly what each side changed, in git's own real conflict format.

cd ~/team-recipes && cat dietary-notes.md

student@lab:~$ cd ~/team-recipes && cat dietary-notes.md <<<<<<< HEAD Dietary Notes (Vegan-Friendly) ======= Dietary Notes (Gluten-Free Friendly) >>>>>>> feature/gluten-free-notes General notes for adapting recipes.

✏️ Resolve It for Real

Combine both real intents into one line, and complete the merge.

cd ~/team-recipes && printf 'Dietary Notes (Vegan-Friendly, Gluten-Free Friendly)\n\nGeneral notes for adapting recipes.\n' > dietary-notes.md
cd ~/team-recipes && git add dietary-notes.md
cd ~/team-recipes && git commit --no-edit
cd ~/team-recipes && git push
cd ~/team-recipes && git log --oneline --graph -6

student@lab:~$ cd ~/team-recipes && printf 'Dietary Notes (Vegan-Friendly, Gluten-Free Friendly)\n\nGeneral notes for adapting recipes.\n' > dietary-notes.md student@lab:~$ cd ~/team-recipes && git add dietary-notes.md student@lab:~$ cd ~/team-recipes && git commit --no-edit [master 58e0279] Merge pull request: gluten-free notes student@lab:~$ cd ~/team-recipes && git push Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 408 bytes | 102.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 To ../recipes-origin.git ceb8b5b..58e0279 master -> master student@lab:~$ cd ~/team-recipes && git log --oneline --graph -6 * 58e0279 (HEAD -> master, origin/master, origin/HEAD) Merge pull request: gluten-free notes |\ | * c146c5b (origin/feature/gluten-free-notes, feature/gluten-free-notes) Mark dietary notes as gluten-free friendly * | ceb8b5b Merge pull request: vegan-friendly notes |\ \ | |/ |/| | * c8fd194 (origin/feature/vegan-notes, feature/vegan-notes) Mark dietary notes as vegan-friendly |/ * 6e4e821 Add dietary notes file * 02d28bb Merge pull request: pantry checklist |\

Lab 2.2.3 complete. A real, unavoidable conflict between two parallel features, planned for and resolved:\n\n\n First merge, genuinely clean : ✅ vegan-notes\n Second merge, real conflict : ✅ gluten-free-notes\n Conflict read and resolved : ✅ both intents kept\n

Enable JavaScript to run the live terminal and track your progress.