Friday, February 01, 2008

Version Control at Home

If you spend time programming at home, I strongly recommend using some kind of version control system, such as CVS, Subversion or Perforce.

Basically a version control system is a repository which stores a history of all the major versions of your source files. You can modify a bunch of files, and then 'check them in' together. Since the system knows all the versions of your files, you can do things like:
  • Compare different versions of a file, to see what changed, and when code was introduced.
  • 'Get' and old version of all your source. This can be handy if your code stops working, and you have trouble working out why. You can go back, find the version which last worked, and then compare the versions.
  • Discard the changes you've made since you last checked in, reverting back to the last good version. This is one of my favourites :)
You can also do more advanced things, like branching the code base. This can allow you to keep a stable branch, if you're going to attempt some big/risky changes.

CVS and Subversion are both free. Perforce is free for small scale personal use (2 users max). Perforce is quite popular in gaming companies too. I use Perforce at work, and so decided to use it at home too. Installing a version control system can be a bit daunting, but there are good tutorials out there if you look.

I don't recommend version control to the absolute beginner, it's better to focus on learning the language and making little sample apps. But if you're going to work on one program, for a while, then I recommend it.

No comments: