Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Master Git's Interactive Staging for Cleaner Commits
May 24, 2026
Ever find yourself ready to commit, but you've made changes across three different features in the same file? Instead of committing everything at once and writing a messy commit message, use `git add -p` (or `--patch`). This command lets you review your changes block by block (or 'hunk') and decide whether to stage it, skip it, or even split it into smaller pieces.
It keeps your pull requests incredibly clean and makes rolling back specific changes a breeze. Your team will thank you for the highly focused, readable commit history.