Version control with Subversion on Mac OS X

We all know that we should back up our important data frequently. Many of us do. But backups don’t give you the fine-grained control of changes to source code that a version control system does.

For a long time (too long) I didn’t use version control at all. Well, unless you count manually duplicating files, which is far from a good solution. But I always felt that I really, really should be using version control. The problem was that I never got around to setting anything up since I thought I had to use a Subversion server, and my attempts at getting one up and running were unsuccessful.

It turns out that getting started with version control is much easier than I thought, at least as long as you don’t need to be able to access your repositories remotely. Accessing repositories through your local file system eliminates the requirement for a separate version control server and lowers the barrier significantly. Too bad I didn’t know about this option earlier.

There are several version control systems available, but the one I use is the open source Subversion.

Working remotely

To enable everybody on your team to use the same repositories, which is kind of the point if you’re using version control in a team, you need to set up a server. You will probably also want to configure it to let people access it through the svn or http protocols.

How to set up a Subversion server and configure it properly is beyond the scope of this post (and beyond my knowledge), so please read Chapter 6. Server Configuration of the Subversion Book for details on that if you are interested.

Working locally

Sometimes you don’t need to be able to access your repositories remotely. Maybe you’re the only person working on a project or everybody on your team can access the repository server via file://. If that’s the case you can use file system repositories instead, which is easier for those of us who aren’t skilled server admins.

At my dayjob we have a Subversion server that allows us to connect remotely, but when I work on my personal projects, like this site, I use local repositories. Creating a local repository is very simple if you use a client that does it for you, such as Cornerstone and Versions.

Choosing a Subversion client

If you’re comfortable using command line tools you can either build Subversion yourself from the source code or download a binary package. There are various options available on the Getting Subversion page on the Subversion site. Another option is to download one of Martin Ott’s Subversion packages.

Some people prefer working in a Terminal window, but I personally like using something that has a GUI, at least for version control. I feel that it gives me a much better overview.

The number of graphical Subversion clients to choose from used to be quite limited for us Mac OS X users, but over the last year or two a number of new options have been made available. These days there are many ways of communicating with a Subversion repository without using the command line.

Here are the standalone Subversion clients that I have tested:

There are several code editors that have integrated Subversion support. Some of them are:

Some of these applications use the command line Subversion client that is installed on your Mac, while others bundle Subversion so you never have to think about it.

I’m not going to review each application here. They all have their pros and cons, but my current favourite is Cornerstone. Try them out yourself and use what works best for you. There are trial versions of all these applications (except for svnX which is free) so you can try before you buy. If you don’t have the budget for a Subversion client right now, svnX does the job. Or you could use the integrated support in your code editor if you use TextMate, BBEdit, or Coda.

Get started now

In the end it is much more important that you do use some kind of version control than which client you use. In case you’re still feeling that all this version control stuff sounds difficult, perhaps reading A Visual Guide to Version Control will make things clearer.

And finally, remember that even though using version control will help you recover from mistakes you make, you do need to remember to make backups of your Subversion repository.

Posted on December 10, 2008 in Coding, Productivity