Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Mastering git add -p

April 6, 2026

Ever find yourself finishing a feature only to realize you’ve accidentally included a few debug console.log statements or unrelated configuration changes? Instead of staging the entire file, try using git add -p. This "patch" mode breaks your changes into small chunks (hunks) and asks you whether to stage, skip, or even split them further. It’s a lifesaver for keeping your commits clean and focused, ensuring that only the code that actually belongs in the PR gets through.