<?xml version="1.0" encoding="UTF-8"?>
<post>
  <body>&lt;p&gt;Today I began helping out on an &lt;a href="http://www.intridea.com" target="_blank"&gt;Intridea&lt;/a&gt; project that (by the client's request) uses Subversion as their revision control system instead of Git.&amp;nbsp; Initially I was a bit dismayed.&amp;nbsp; Hell, I actually felt a little sick to my stomach.&amp;nbsp; Git has treated me very well over the past year, and I hadn't touched a Subversion repo in even longer.&lt;/p&gt;
&lt;p&gt;Git-svn had crossed my mind, but it wasn't until a coworker suggested it that I decided to give it a try.&lt;/p&gt;
&lt;p&gt;The first thing was to get it installed.&amp;nbsp; I followed &lt;a href="http://blog.emmanuelbernard.com/2009/01/how-to-install-git-and-git-svn-on-mac.html" target="_blank"&gt;this tutorial&lt;/a&gt; and only had to make one small change.&amp;nbsp; Adding &lt;em&gt;&lt;em&gt;/opt/local/libexex/git-core&lt;/em&gt;&lt;/em&gt; to my path didn't work.&amp;nbsp; I did a quick whereis to find out that my git-svn executable is in the &lt;em&gt;/usr/local/git/libexec/git-core/&lt;/em&gt; directory.&amp;nbsp; I updated my path and everything was kosher.&lt;/p&gt;
&lt;p&gt;Now to set up the repo.&amp;nbsp; Most of the tutorials that I found covered setting up a new svn repo with git-svn like &lt;a href="http://git.or.cz/course/svn.html" target="_blank"&gt;this one&lt;/a&gt;, but in my case, the svn repo had been around for quite some time.&amp;nbsp; Being the wannabe-know-it-all that I am, I decided to just go ahead an clone the svn repo, like so:&lt;/p&gt;
&lt;pre class="terminal"&gt;git-svn clone http://path-to-the-svn-repo&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;After about ten minutes of watching the clone chug away, I thought something was up.&amp;nbsp; Well, it turns out that if you don't include the proper options, the clone will pull down all branches, tags, whatever.&amp;nbsp; I didn't want, or need all of that.&amp;nbsp; All I wanted was trunk.&amp;nbsp; After a brief glance at the git-svn docs, I tried again with the &lt;em&gt;--trunk&lt;/em&gt; flag.&lt;/p&gt;
&lt;pre class="terminal"&gt;git-svn clone --trunk http://path-to-the-svn-repo&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Aparently, the &lt;em&gt;-s&lt;/em&gt; option also works.&amp;nbsp; It tells git-svn that you svn is in the standard layout with trunk, branches, tags, and whatnot.&lt;/p&gt;
&lt;p&gt;This time it ran for only five minutes before I asked myself wtf was going on.&amp;nbsp; I realized that it was pulling down every single revision, which I really didn't need.&amp;nbsp; 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&amp;nbsp; I just let it ride.&lt;/p&gt;
&lt;p&gt;Once that was done, I was good to go.&amp;nbsp; 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.&amp;nbsp; I used &lt;a href="http://www.viget.com/extend/effectively-using-git-with-subversion/" target="_blank"&gt;this tutorial&lt;/a&gt; by &lt;a href="http://www.viget.com/about/team/cnixon" target="_blank"&gt;Clinton Nixon&lt;/a&gt;, who I had recently seen do a talk on Scala at the &lt;a href="http://developer-day.com/events/2009-durham.html" target="_blank"&gt;Developer Day&lt;/a&gt; in Durham, to help guide my general git-svn workflow.&lt;/p&gt;</body>
  <created-at type="datetime">2009-04-21T05:44:57Z</created-at>
  <description>How to use Git with an existing Subversion repository via git-svn.</description>
  <id type="integer">28</id>
  <keywords>git,git-svn,svn,subversion</keywords>
  <published type="boolean">true</published>
  <slug>making-subversion-less-painful-with-git-svn</slug>
  <title>Making Subversion less painful with git-svn</title>
  <updated-at type="datetime">2009-04-28T16:03:24Z</updated-at>
</post>
