Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Mastering Atomic Commits with Git Patch

April 19, 2026

Ever find yourself halfway through a feature only to realize you've fixed three unrelated bugs and tweaked some styling? Instead of dumping everything into one massive "work in progress" commit, try using git add -p. This command breaks your changes into "hunks," allowing you to interactively decide which specific lines of code belong in which commit.

It’s a game-changer for keeping your pull requests clean and your git history readable. Plus, it gives you one last chance to review your code before it’s staged, often catching stray console logs or temporary comments you forgot to remove.