Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

Mastering Git's Interactive Patch Mode

May 23, 2026

We've all been there: you've spent the last hour writing great code, but you also sprinkled in some temporary console logs and formatting changes that shouldn't go into your final commit. Instead of committing everything or manually reverting files, try using 'git add -p' (or '--patch'). This command launches an interactive prompt that lets you review your changes chunk by chunk ('hunks') and decide whether to stage, skip, or even split them. It's a fantastic way to keep your commits clean, focused, and free of debugging leftovers without losing your train of thought.