Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Master the Art of Atomic Commits with Git Patch

February 15, 2026

If you've spent an hour coding and realized you've fixed three different bugs in one go, don't just dump them into a single commit. Use `git add -p` (patch mode) to review your changes hunk by hunk. This lets you selectively stage only certain parts of a file, making your commit history much cleaner and easier for your teammates to review.

It’s also a great final sanity check. As you step through each change, you'll often catch a stray debug statement or a temporary hack that you forgot to remove. It turns your staging process into a mini-code review for yourself.