Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Master the Art of Selective Git Commits
May 26, 2026
Ever finished a long coding session only to realize you've written three different features and a couple of random bug fixes, all in the same files? Instead of staging everything at once, use "git add -p" (or "--patch"). This handy command lets you review your changes chunk by chunk, allowing you to selectively stage only the lines of code that belong to a specific logical change.
By splitting your work into smaller, cohesive commits, you'll make your pull requests much easier to review, and your future self will thank you when you're trying to track down a bug using "git bisect" later on.