Interactive Rebase
Squash, reorder, and edit commits
Interactive rebase lets you rewrite recent history: squash, reorder, edit, or drop commits.
Combine multiple commits into one. Great for cleaning up 'WIP' commits before merging.
Before rebase
C3
Fix typoC4
Another fixC5
Final fixC3Fix typo
C4Another fix
C5Final fix
Terminal
$ git rebase -i HEAD~3 # Change 'pick' to 'squash' for C4 and C5 pick C3 Fix typo squash C4 Another fix squash C5 Final fix