Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Don't Commit Everything: Patch Staging
February 4, 2026
We've all been there: you made three unrelated changes in one file, and now you only want to commit the bug fix, not the experimental feature. Instead of staging the whole file with `git add <file>`, try using `git add -p` (or `--patch`). Git will walk you through the file, showing you "hunks" (blocks of changes) and asking if you want to stage each one individually. This keeps your commits clean, atomic, and easy to review, making your Git history a pleasure to read.