When we first began using SVN a few years ago commits typically happened once a day, if that often. Over time we have learned that fine-grained commits offer many benefits over bulk commits, I’ve outlined a few below.
Searching commits is easier
Committing more often means that you are putting log messages on a smaller amount of work. If you commit a small CSS fix, you’re going to write in the log “Fixing such and such css error”. If you make that CSS fix with many other unrelated fixes throughout the day, you are unlikely to list it in the log. Ideally, most commits should be tied to a bug/case # in your bug tracking tool of choice.
In a team environment, committing often is essential for avoiding conflicts when using a non-file-locking system like SVN. If you don’t commit multiple times a day you may find yourself resolving many conflicts or other issues at the end of the day.
File locking repositories seems to encourage bulk commits and less granularity in my experience. It’s not uncommon to see entire projects and folders checked out for days or weeks in some of these environments. These people see source code control as no more than source code backup and are missing out on the true value of scc.
How does source code control make code cleaner? I’m sure you’ve either seen (or written yourself) code that has commented code blocks all throughout the code. I did this in my younger days, but now it stands out as an eyesore. There’s really no reason to check something in with commented out code in it. If the code was previously in, then you should already have it saved to a previous revision which you can easily pull up and copy the old block of code as needed.
Less Missing Files
It’s pretty annoying when you are trying to compile a project and it turns out there is a missing file. You have to figure out who committed the code and get them to figure out what files are missing and commit them.
If you are committing often and in smaller batches, you are less likely to forget all of the files you’ve had to add to the project.
The end result? Time saved.
Some people probably see committing often as a waste of time, but as with many things, the little bit of extra time you put into it winds up saving a lot of time when you don’t have to deal with all the headaches that can occur if you don’t commit often.