I have a habit of constantly making minor edits to my code whenever I spot something I don't like - be it a bug or just some sloppy piece of code I see how to improve. Neurosis-Driven Development.
The problem is this habit doesn't work well with VCS. I can be working on a new function and, by the time I finish it, I have 10 unrelated edits in different parts of the code (usually in the same file). I am left with three options:
- Every time I want to make a minor edit, switch to
work
branch, commit the progress, switch tomaster
, make the minor change, commit, switch back towork
. - Feel free to edit as much as I want, then commit everything together. But mixing conceptually different edits in one commit is a bad practice.
- Same as above, but when the time comes for the big commit, try to disentangle the edits with tools like
git add --patch
and commit them separately
Any of these options makes me want to give up on VCS whatsoever. Is there a fourth option I don't see or is one of the above not as bad as it sounds?