Reasons for using the GIT SVN bridge

Posted by Tejus Parikh on March 12, 2009

I’ve already posted about why I like Git better than Subversion. This motivated me to install the GIT-SVN bridge up to my work SVN repository. Using the bridge is a bit confusing at first. This tweet by Calvin Yu pointed out is right on the money. Git’s interface isn’t great, but it is powerful. There are two major resources that I use to use the bridge effectively: this blog post and the git-svn man page which has a lot of examples. Between the two, I’ve been able to do almost everything I want. So why go through the effort of cloning your SVN repository (which took a half day for me)? What follows are my reasons.

Local Branching

We’ve got a fairly large development team. If we let encourage every developer to create a branch for each whim, our branch space would be quickly polluted. Since most of the exploratory work is generally done by one person, there isn’t any real need for collaboration either. The end result is work that often just disappears as developers find it hard to maintain a lot of uncommitted changes. Git allows you to create local branches. These branches exist within your repository. You can commit to them as often as you like.

Fast Branch Switching

Git is a clone of your whole repository. Most importantly, it’s an efficient clone of the whole repository. Which means you only have to download deltas when you change branches. If you need to work on a new branch in SVN, you need to check the whole thing out. On a sizable repository hosted off-site, this can take a while. Recently, I was working on a local branch. I needed something from the head of another branch, so I checked that out and did what I needed to do. Then I got an email from my boss asking me to look at a bug. I checked out trunk. It was an easy fix and shortly thereafter, I got another email asking me to commit it to the release branch, a branch that I’ve never checked out. I checked it out and committed it there too. With git-svn, this whole process took 20 minutes, including the time to fix the bug. Given that each branch is nearly half a gig, and our outside line isn’t very fast, that’s pretty impressive.

Cherry Pick

Git has a command that pulls a single commit from one branch to any other branch. Sure you can do the same thing with SVN merge, but nobody remembers that syntax.

Local Commits

It’s really nice to be able to occasionally commit intermediary code without breaking the build. When I make a mistake or can’t figure out why something that was working isn’t anymore, having past versions to look at is helpful.

The Stash

Occasionally you have to switch gears. Git Stash lets you do that without losing work.

Being Trendy

Hey, style is important too :) Seriously, the benefits outlined above, though simple, can save a massive amount of time when things are breaking all over the place. That alone is causing the use of the bridge to slowly spread through the organization.

Tejus Parikh

Tejus is an software developer, now working at large companies. Find out when I write new posts on twitter, via RSS or subscribe to the newsletter: