Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Atomic Commits with Git Patch Mode
March 14, 2026
We’ve all been there: you’re working on a feature, notice a small bug, fix it, and suddenly your workspace is a mess of unrelated changes. Instead of committing everything at once, use git add -p. This "patch" mode breaks your changes into small "hunks" and asks you, one by one, if you want to stage them.
This allows you to keep your commit history clean and atomic. By separating your feature work from your refactors or bug fixes, you make it much easier for your teammates to review your PRs and for your future self to track down when a specific change was introduced.