Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Clean Up Your Commits with Git Autosquash
May 23, 2026
Ever found yourself making tiny typo-fix commits right after opening a PR? Instead of manually rebasing and renaming them, try using `git commit --fixup <commit-hash>`. This marks your new change as a fixup of an older commit.
When you're ready to clean up, run `git rebase -i --autosquash <branch-base>`. Git will automatically arrange your commits and merge the fixups into their targets without you having to manually move lines around in the interactive editor. It keeps your git history pristine and your reviewers happy.