Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Mastering Granular Commits with Git Add Patch
May 14, 2026
Ever find yourself finishing a long coding session only to realize you’ve changed three different things in one file? Instead of dumping everything into a single messy commit, try using git add -p. This command opens an interactive mode that lets you review each "hunk" of code changes one by one.
You can decide to stage a specific change, skip it, or even split it into smaller pieces if the hunk is too large. It’s a total game-changer for keeping your pull requests clean, focused, and much easier for your teammates to review.