I, Developer


Moving from Subversion to Git

Written by John Moses on March 21, 2014

Subversion was the first revision control system I learned and used both professionally and personally. Using it professionally was easy, as the server was already setup. On a personal basis it was more work as you had to setup a server. That problem was solved by distributed revision control systems like git, mercurial and bazaar. I think using any revision control systems puts you in the lead anyway. But being able to setup a repo by just typing git init and not have to configure a server is cool.

Goodbye old friend

What really motivates me to switch is the ability to use multiple remote origins (think servers with Subversion). Not to mention that finding a free remote origin like Github or Bitbucket is relatively easy. And with Atlassian tools like Jira, commit hooks are super easy and do not require complex configuration (subversion with bugzilla anybody?)

Other people have problems too (see below list). My personal favorite is file locks. Yuck.

######Merging problems

######Locking problems

Getting down with Git

Github is really cool. It is not the only reason I prefer Git, but it is definitely at the top of the list. In a quick nutshell, here is why I get down with git (see what I did there?):

More reasons are eloquently documented by Scott Chacon, a founder of Github

Moving a project from Subversion to Git

Now that you are convinced you should move your project out of Subversion and into Git there are a few steps you need to take so that you can save history.

First, you need to make sure each user in the auth.conf file in Subversion has a line in an empty text file that links to there name and email address.

Sample auth.conf file:
JMOSES=jomama,JOMAMA
NDOGG=ruggster,RUGGSTER

Matching authors.txt file:
jomama = John Moses <[email protected]>
JOMAMA = John Moses <[email protected]>
ndogg = Nate Dogg <[email protected]>
NDOGG = Nate Dogg <[email protected]>

Second, create a directory to store your new repo. mkdir project && cd project

Create a new git repo git init

Then checkout the project from subversion, passing –no-metadata is actually recommended against but it worked for me so I am posting it here. git svn init http://svn.com/proj --no-metadata

Pass your new authors file to match up users, if done properly your Github user account will now show your contributions
git config svn.authorsfile ~/authors.txt

And then bring it home
git svn fetch

I actually had to run fetch a few times as I was burned by the case sensitivity of the auth.conf/authorsfile, which is why I have multiple lines for different users.

Running git svn fetch actually saves your progress too, which is nice for large projects.