I tell people to use
git add -p not
git add FILE or
git add .
The benefits are huge:
- You decide exactly what’s in your commit. Any later inspection of your commit is improved — code review, git blame, git log, git bisect — everything. No more “Changed WidgetManager to use Widgets not Sprockets, corrected docs for SprocketManager, deleted four unnecessary files and added a new log image.”
- You review your changes before committing. Another chance to spot bugs or realize that your documentation doesn’t make sense or that you left in a TODO or a debug statement.
- You won’t accidentally commit work in progress.
You aren’t welcome on my project if you don’t use
git add -p! And
git add ., frankly, should be an error!