sharp bites

standing on the shoulders of giants

The road to Continuous Integration. Part 1: Get your source under control!

time-machine If you are not already doing so, put your stuff under source control. Right now. It doesn’t matter how small your project is or whether you are working alone. If it’s worth your time, it’s worth putting it under source control.

What is Source Control?

Source control, often referred to as VCS (Version Control System) or SCM (Source Code Management) is the management of changes in files. It’s a time machine that lets you see how your project looked like at any given point in time.

For a more detailed introduction, see Eric Sink’s Source Control HOWTO or the SVN book.

Why you should use a SCM tool

It gives you an infinite undo-button. No matter how much you have screwed up, you can always go back to a stable point.

You can share code with other people.

You can keep track of your changes over time. This allows you to know who changed what, when and (luckily, if you use meaningful comments) why.

You can maintain multiple code bases of your software. Even if you only have one active version at a time, it’s useful to start new development independently.

What should you store?

Everything you need to build your product. That includes your sources, of course, but also any libraries your projects depends on (avoid referencing GAC’ed or installed libraries), any tools you use and any scripts that you need as part of the process. Nothing should be dependent of your machine installation.

The goal is to be able to get into a clean machine, get a copy of the codebase from your source repository, build it (automatically) and voilà, you are done and ready to start working!

WHICH SCM ARE YOU?

There are many alternatives, just pick one, (oh well, not THAT one). If you don’t want to set up and maintain a server, you can use one of the many online services available (some of them are just for open source projects, and some have free and paid plans). Which one is best will depend on your specific needs:

If you…
  • want an easy to install, easy to start tool -> svn
  • want a powerful tool, at the expense of a bit steeper learning curve -> git, mercurial, bazaar
  • need to use a mature GUI/integration with Visual Studio -> svn, tfs
  • need good branching and merging support -> git, mercurial, bazaar
  • need an all-in-one tool (source control, bug tracking system, continuous integration) completely integrated, even if the individual tools are not-so-great for the -> tfs
  • are a Microsoft-only shop -> tfs

For the clients there are also a myriad of tools available for all platforms. You have command-line interfaces, standalone GUI tools (tortoisesvn, tortoisehg, tortoisegit) and IDE integrated (VisualSVN, AnhkSVN, Git Extensions).

Comments