Module lessons (2/4)
Three-way merge anatomy & branch cleanup
Understand how Git compares Base, Ours and Theirs to integrate diverged branches automatically.
What you'll learn in this lesson
- Understand how Git performs an automatic 3-way merge using Base (
merge-base), Ours (HEAD), and Theirs. - Predict when Git auto-merges cleanly (non-overlapping files or separate lines) vs pauses for conflict resolution.
- Clean up merged feature pointers safely with
git branch -dafter integration.
Overview
Comparing ONLY the two branch tips (Ours vs Theirs) is hopelessly ambiguous: if src/auth.ts exists on feat/login and is missing on main, did feat/login just create it or did main just delete it?!
Git solves that riddle cleanly by looking backward to the common ancestor (Base) where both branches diverged (git merge-base main feat/login) and combining only changes since Base:
Sections covered in this lesson
- 1Why Three Trees Beat Two Trees
- 2Observe 3-Way Merges vs Rebases Visually
Unlock "Three-way merge anatomy & branch cleanup" and the full Git & Modern Collaboration curriculum
Understand how Git compares Base, Ours and Theirs to integrate diverged branches automatically.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Git & Modern Collaboration plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.