Module 08 of 12

Rebasing & Rewriting History

Lessons

About This Module

A clean, readable commit history makes a project easier to understand, review and debug. Git gives you the tools to shape that history, and this module is where you learn to use them. It's also where Git starts to feel powerful, because you stop being limited to adding new commits and learn to reorganise the ones you already have.

You'll start with the two ways to bring branches together: merge, which preserves history exactly as it happened, and rebase, which replays your commits on top of another branch to give a straight, linear history. Then you'll go deeper with interactive rebase, which lets you reword messages, reorder commits, drop the ones you don't need, and squash a messy series of small commits into one meaningful change. You'll also learn the golden rule of rebasing: only rewrite commits that haven't been shared, because rewriting history that other people already depend on causes real problems for a team.

Watch the lessons in order, then continue on to Team Workflows & Strategies.

Lessons

4 videos
01

Git Basics: Merge and Rebase

A very short introduction to the difference between merge and rebase, with a quick example workflow for each. A good starting point before going deeper.

02

Learn Git Rebase in 6 Minutes (Explained with Live Animations)

An animated explanation of how rebase differs from merge, followed by a demo of a realistic rebase workflow.

03

Advanced Git Tools: Interactive Rebase, Cherry-Picking, Reflog, and More

Tobias Günther of Tower shows how to rewrite commits with interactive rebase, and also covers cherry-picking, the reflog, submodules and searching your history.

04

How to Squash Commits in Git

A quick look at squashing several commits into one with interactive rebase, so your history stays clean and easy to read.