I love the smell of commiting in the morning. It smells like victory. My current strategy is to commit throughout the day until about 3pm. After that I will only commit code that I need to do a release that evening. Otherwise it can wait until the next day. This has a few advantages:
- I have a chance to think about it in the evening or when I am trying to get to sleep. I might think of a better solution or a way to tidy up my current solution.
- When I commit it I have a clear mind, if the code I wrote last night is hideous I am much more likely to fix it or not commit it at all.
- After committing I am present to clean up the repercussions. Many times I have committed just before leaving and co-workers have had to revert or fix my commit. This just wastes time for them, I know the reasoning for my changes, other possible solutions and most importantly I know how the code works. If someone else gets a compile error or run time bug it might not be in an area they are familiar with. They will have to read through the code and work out what it does, what the problem is and how to fix it.