Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Clean Commits with Git Add Patch

April 12, 2026

We've all been there: you're halfway through a feature, notice a tiny typo in an unrelated function, and fix it on the spot. Now your staged changes are a mess. Instead of committing everything at once, try using "git add -p". This "patch" mode breaks your changes down into small chunks (hunks) and asks you one by one if you want to stage them.

This keeps your commit history laser-focused and makes code reviews much easier for your teammates. It's like having a final sanity check before your code even hits the staging area.