Subversion to Git

The whole world has not quite converted to Git yet, but it is well on the way. To actually work with a Subversion backend, a standard Git installation includes git-svn which implements an excellent two-way support. If you just want to track a Subversion repository without pushing to it, svn2git gives a better conversion in that it properly converts Subversion tags to real Git tags as well as some other house keeping.

I have used (and contributed to) svn2git before, but not for a while. Now I needed to use it again and realised that it is pretty sensitive to what Git version you have installed. I first tried with the latest Homebrew version (1.8.4) and it failed. I then uninstalled the Homebrew version and tried the Apple supplied one (1.7.10.2) and that failed too. Some Googling told me that version 1.8.3.1 seemed to work all right. So how to get that one? Turns out that is pretty simple nowadays.

  1. cd into the Homebrew folder (normally /usr/local)
  2. Run brew versions git to see all available versions
  3. Copy the checkout command from the list and run it.
  4. Run brew unlink git && brew install git.
  5. Run git checkout with the file path from 2 above.

Voilà! You now have the correct version installed. But wait, there’s more! You can now install several versions of the same program by following the steps above and then switch between them with brew switch <formula> <version>. Very convenient.