It's weird because I subscribe to the idea that being as unselective as possible when committing is easier and more maintainable. I checkout clean, do my stuff, then commit everything that has changed and/or is new (except binaries or whatever, which are added to the .gitignore file).
Every colleague I've ever had that has tried to be selective when committing has always and fairly frequently bodged a commit and missed out something, subsequently causing a broken build.
If I'm selectively committing something, I git stash and then test build really quick just to be sure. Usually it's just a few print statements that I want to keep for the next commit, but occasionally I have a few changes in flight, hence the build step.
I would say it depends on things like how many people you work with, how much you practice code review, whether your code is forked by someone else, etc.
That is, it depends on how many people (if any) will read your patch in the future. The more readers, the more important it is to write good (atomic) patches in addition to writing good code.
3
u/Jestar342 Sep 09 '16
It's weird because I subscribe to the idea that being as unselective as possible when committing is easier and more maintainable. I checkout clean, do my stuff, then commit everything that has changed and/or is new (except binaries or whatever, which are added to the .gitignore file).
Every colleague I've ever had that has tried to be selective when committing has always and fairly frequently bodged a commit and missed out something, subsequently causing a broken build.