DEV Community

Toolloom
Toolloom

Posted on • Originally published at toolloom.com on

Clean Up Your Commit History Effortlessly with Git Fixups

We've all been there: you submit a pull request, notice a tiny typo, and end up making a commit named "fix typo" or "temp." Instead of cluttering your git history, try using git commit --fixup [commit-hash] when committing the fix. This marks your new change as a fixup of that specific older commit.

When you're ready to clean things up before merging, run git rebase -i --autosquash origin/main. Git will automatically organize your interactive rebase todo list, placing the fixup commits directly beneath their parent commits and marking them to be melted in. It keeps your commit history pristine without the manual drag-and-drop headache.

Top comments (0)