Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Mastering Selective Staging with Git Patch

March 21, 2026

Ever find yourself finishing a feature only to realize you’ve also fixed two bugs and added some messy console logs in the same file? Instead of staging everything with "git add .", try using "git add -p". This interactive mode breaks your changes into "hunks" and asks you which ones you actually want to commit.

It is a lifesaver for keeping your commit history clean and focused. It essentially forces you to do a quick self-review of your code before it ever hits the repository, helping you catch those stray print statements before they become permanent.