Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Clean up your commits with git add -p

March 21, 2026

We've all been there: you’ve finished a feature, but you also fixed a tiny bug and cleaned up some whitespace in the same file. Instead of bundling it all into one messy commit, use 'git add -p'. This "patch" mode lets you review every single change hunk by hunk and decide whether to stage it or not.

It is a great way to catch forgotten console.log statements before they hit the repo. It ensures your commit history stays clean, focused, and actually tells a story to your teammates during code reviews.