Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Clean Up Your Commits with Git Add Patch

April 6, 2026

We’ve all been there: you’ve spent three hours fixing a bug, but you also refactored a helper function and added some logging. Instead of dumping everything into one messy commit, try using git add -p. This 'patch' mode lets you review each change (or 'hunk') individually and decide whether to stage it or skip it.

It’s a great way to catch stray console.log statements before they hit the repository and ensures your commit history stays logical and easy for your teammates to follow. It essentially acts as a final self-code-review before you push.