Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Mastering Selective Commits with Git Add Patch
March 4, 2026
Ever find yourself finishing a feature only to realize you've made a dozen tiny, unrelated tweaks across five different files? Instead of dumping everything into one messy commit, try using `git add -p`. This "patch" mode lets you review every single change (or "hunk") individually. You can decide to stage it, skip it, or even split it into smaller pieces.
It’s a lifesaver for keeping your commit history clean and readable. By grouping related changes together and leaving out the "oops" console logs or temporary comments, your future self (and your teammates) will have a much easier time during code reviews.