Reputation: 77
I have trouble getting into the habit of using git or source control in general. In the beginning of a programming session I am aware that I should commit frequently but after a while I have this coding tunnel vision and forget to commit and then hours later I realize I coded so much that I can't really make useful commits without breaking everything apart which would take a lot of time.
Has anybody some tips and tricks in how a beginner should get into the habit of using a source control system properly.
Upvotes: 3
Views: 56
Reputation: 94483
Commits are intended to be read. So my advice is: read! Read your own logs and diffs. Read other repositories. Soon you start to distinguish bad code from good code, bad commits from good, bad history from good, clear and understandable from write-only trash.
Then return to your commits. You'll see what's wrong with them and will try to do better commits almost automatically.
Technical hint: use git add -p
to collect parts of you work and combine them in commits. You don't need to commit everything that was changed at once. See https://git-scm.com/docs/git-add#git-add-patch
Upvotes: 1