Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Master the Art of Laser-Focused Commits with `git add -p`
May 25, 2026
Ever finished a long coding session only to realize you've written three different features and a couple of bug fixes all in the same files? Instead of dumping everything into one massive, messy commit, use `git add -p` (or `--patch`). This command runs an interactive prompt that lets you review your changes chunk by chunk (called "hunks") and decide whether to stage them, skip them, or even split them further.
It's a fantastic habit that keeps your pull requests clean, makes code reviews a breeze, and saves your future self a ton of headaches if you ever need to revert a specific change without breaking everything else.