Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Mastering the Patch in Git

March 10, 2026

Ever found yourself working on a feature and accidentally fixing a typo or adding a console log in a completely unrelated file? Instead of committing everything at once, try using git add -p. This patch mode lets you review every single change individually and decide whether to stage it, skip it, or even manually edit it on the fly.

It is a lifesaver for keeping your commit history clean and focused, ensuring that every commit does exactly one thing. It serves as a final sanity check before your code hits the repository, helping you catch those stray debug statements before they make it to production.