Lesson 15 / 26

Interactive Rebase

Reword, squash, or reorder recent commits before sharing them.

Clean up before pushing

Opens an editor listing your last 3 commits — mark each pick, squash, reword, or drop.

git rebase -i HEAD~3

Output:

pick a1b2c3d Add login form
squash 9f8e7d6 Fix typo
squash 4d5e6f7 Fix another typo

Squashing fixups

Interactive rebase is great for turning "fix typo" commits into one clean commit — but only on branches you haven't shared yet.