Check In Often
Date Published: 12 July 2016
This is post 1 of 2 in the series “Developer Tips”
Tips for developers, archived from Dev Tips Weekly emails.
Check in your code. Often.
It doesn’t matter if you’re using Team Foundation Server, Git, Subversion, or another form of source control, you should be sure to check in your code frequently. Right now, do you have code that you’re working on (or were working on) and which isn’t checked in? How long ago did you check it out? If the answer is more than a couple of hours, it’s too long.
The more frequently you commit your code, the faster integration issues will be detected, especially if you’re using continuous integration. Also, if you find that you’ve coded yourself into a corner (or dead end), you can always roll back to a previous commit. You might even need to go back a few commits. The more often you commit your code to your source control repository, the better off you’ll be when the time comes to roll back.
Avoid the urge to use Copy Folder Versioning. Use source control, and then, use source control. If you’re following Test Driven Development, consider upgrading the Red-Green-Refactor process with Red-Green-Refactor-Commit, and see if it doesn’t lead you to write better, more maintainable code.
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.