Found a typo in commit from 5 commits ago? –fixup marks it for automatic squashing later.
Create Fixup Commit:
# Find commit hash to fix git log --oneline # abc1234 Add user authentication # def5678 Add email validation ← Want to fix this # Make your fix, then: git add . git commit --fixup def5678
Auto-Squash Fixups:
git rebase -i --autosquash HEAD~5 # Git automatically: # - Finds fixup commits # - Moves them after target commits # - Marks them for squashing # - You just save and close!
Why Better: No manual reordering in interactive rebase. Git does it automatically!
