Today I began helping out on an Intridea project that (by the client's request) uses Subversion as their revision control system instead of Git. Initially I was a bit dismayed. Hell, I actually felt a little sick to my stomach. Git has treated me very well over the past year, and I hadn't touched a Subversion repo in even longer.
Git-svn had crossed my mind, but it wasn't until a coworker suggested it that I decided to give it a try.
The first thing was to get it installed. I followed this tutorial and only had to make one small change. Adding /opt/local/libexex/git-core to my path didn't work. I did a quick whereis to find out that my git-svn executable is in the /usr/local/git/libexec/git-core/ directory. I updated my path and everything was kosher.
Now to set up the repo. Most of the tutorials that I found covered setting up a new svn repo with git-svn like this one, but in my case, the svn repo had been around for quite some time. Being the wannabe-know-it-all that I am, I decided to just go ahead an clone the svn repo, like so:
git-svn clone http://path-to-the-svn-repo
After about ten minutes of watching the clone chug away, I thought something was up. Well, it turns out that if you don't include the proper options, the clone will pull down all branches, tags, whatever. I didn't want, or need all of that. All I wanted was trunk. After a brief glance at the git-svn docs, I tried again with the --trunk flag.
git-svn clone --trunk http://path-to-the-svn-repo
Aparently, the -s option also works. It tells git-svn that you svn is in the standard layout with trunk, branches, tags, and whatnot.
This time it ran for only five minutes before I asked myself wtf was going on. I realized that it was pulling down every single revision, which I really didn't need. I would've stopped it and tried again with the --revision (-r) flag which allows you to specify a revision number, or range of revision number, but the clone was already at rev 900 out of 1100, so I just let it ride.
Once that was done, I was good to go. I could pretty much just treat it as a regular Git repo until I was ready to push any changes back to the svn repo. I used this tutorial by Clinton Nixon, who I had recently seen do a talk on Scala at the Developer Day in Durham, to help guide my general git-svn workflow.