Interactive Rebase
Pick, squash, fixup, reword, drop.
git rebase -i opens a to-do list of commits and lets you rewrite history any way you like before sharing it. Squash noisy WIP commits, drop mistakes, reorder, rename — then replay the cleaned-up sequence as new commit objects.
The Interactive To-Do List
Change the action on each commit, then hit Run rebase to see the resulting history. Try: squash the WIP commit, fixup the auth fix, drop the typo.
rebase-todo (oldest → newest)
Result (run rebase to see)
The Six Actions
pickKeep the commit exactly as-is. Default for every commit. If you don't change anything, nothing changes.
rewordKeep the commit's changes but pause to let you edit the commit message. Useful for fixing typos in messages before sharing.
squashMeld this commit into the one above it. Git combines both commit messages and lets you edit the result. Good for grouping related commits.
fixupLike squash, but silently discards this commit's message. Perfect for "fix typo" or "oops" commits that don't deserve a message.
dropRemove this commit entirely from history. The changes it introduced disappear. Use with care — this is permanent once shared.
editPause the rebase at this commit so you can amend it — split it into multiple commits, add files, change content. Then 'git rebase --continue'.
Running It
HEAD~N tells Git how far back to go. Git opens your $EDITOR with the to-do file — edit the actions, save, close, and Git executes the plan.