DEV Community


Discussion on: Improve Your Git Productivity with Bash

oscherler profile image
Olivier “Ölbaum” Scherler

I always use git add -p when I want to commit. It will go through each chunk of changes and ask if I want to add it or not. It’s a great way to review what you are going to commit, spot and skip some leftover debugging code, and it allows you to make smaller commits at the same time.

You can even edit the patch before adding it, which is daunting at first but can be quite convenient to quickly omit a leftover print statement in the middle of an otherwise valid change.