Module 6 · Lesson 2 of 424/34 in the course~18 min
Module lessons (2/4)
Linearizing branches cleanly with git rebase
Lesson preview5 hands-on exercises readyGit & Modern Collaboration · Module 6 — Rewriting Local History Cleanly
Replay local feature commits sequentially on top of updated main and learn the Golden Rule of Rebasing.
What you'll learn in this lesson
- Replay a diverged feature branch sequentially onto updated
mainusinggit rebase. - Contrast linear rebased history against 2-parent merge commits and combine
rebasewith a clean Fast-Forward merge. - Apply the Golden Rule of Rebasing: never rewrite commits already shared publicly with teammates.
Overview
When main moves ahead with critical fixes while you build a feature, git merge main pulls those upstream updates into your branch via a 2-parent merge commit.
git rebase main offers a crisp alternative when polishing a private PR branch:
Sections covered in this lesson
- 1Replaying Commits onto a Fresh Base
- 2Replay & Inspect Graph Divergence Live
Pro Lesson · Module 6 — Rewriting Local History Cleanly
Unlock "Linearizing branches cleanly with git rebase" and the full Git & Modern Collaboration curriculum
Replay local feature commits sequentially on top of updated main and learn the Golden Rule of Rebasing.
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.