Migrating from SVN to GIT

In: Programming

3 Sep 2009

One of the big benefits of using source code versioning (or source code management systems) is that it allows you to maintain a history of all the changes in code and allows for easy collaboration amongst several developers on the same code base. SCMs will allow you answer the following questions:

  1. Who made what change
  2. What change was made
  3. When was the change made

If you happen to have a number of developers and you’re working on the same project (even if you’re the only developer, this helps) you like to know when a change to the source code breaks the application (this happens alot). Not only that, having an SCM allows you to easily revert that change. This post is not about SCMs but I thought it necessary to provide a little background information.

I recently started using git and have really loved it (although it’s not perfect, it does the job well). I prefer git over subversion (svn) for a major reason that it is distributed: does not require a connection to a server in order to commit to the repository.

Recently, I thought about migrating my svn repositories to git and I found a wonderful resource for that here. I’m not going to attempt to republish what has been said there here. Instead just point out a couple of things I had to do differently.

First of all, depending on the way your git is installed, these are basically the commands to run:

git svn init svn://server/repo/trunk/ --no-metadata
git config svn.authorsfile /path/to/svn-authors
git svn fetch

The difference here is to use git svn instead of git-svn. Also, if you happen to have blank authors (as I had in mine), then your svn-authors file should contain an entry similar to this:

(no author) = Firstname Lastname <emailaddress>

5 Responses to Migrating from SVN to GIT

Avatar

austin_web_developer

September 8th, 2009 at 9:59 am

What is even more wonderful about git is the power of its branching.

The ability to quickly switch between various versions of the app you’re working on, so that you can … for example … go from working on a feature, to making a bug fix, pushing it live then go back to working on your feature … is very compelling.

enjoy.

Avatar

Tim

September 8th, 2009 at 10:18 am

You’re right Austin. Welcome to my blog and I do hope to see more of your comments. Have you heard about stashing in Git? It’s good for those quick bug fixes that you need to make without having to first create a branch.

Avatar

austin_web_developer

September 9th, 2009 at 5:03 am

Yes I’ve heard of stashing ;)
And yes … it is pretty rad.

Avatar

Faiz

September 22nd, 2009 at 10:33 pm

Have u taught of Mercurial. I think it is the next big thing and large sites that host open source codes like Google code are moving from Subversion to it.
Netbeans is fully using it now.

Avatar

Tim

September 23rd, 2009 at 3:09 am

Hey Faiz, your first comment here? Welcome :) I have heard about Mercurial and yes I do agree with you that it’s really gaining some attention these days. It appears to be more robust than Git. I’ve found git to be slow when you’re dealing with really large codebases. I haven’t considered a switch to it majorly because of the teams I’m working with.

With the kind of projects being migrated to Mercurial, I’m sure it wouldn’t be long before I make the switch.

Comment Form

About this blog

Tim Akinbo's Weblog is the personal weblog of Tim Akinbo. Here he discusses issues relating to technology. Special interests include the web, mobile technology and location based services.

Photostream

    Panel Session on Realizing Nigeria's Internet PotentialDelegates during Justin's Keynote PresentationBarCamp Attendees 1main hallmain hall 2main hall 3
  • Budzeg: I remember the days of mobile too... When we were building wapitis like it was going out of fashion. [...]
  • damiet: Tim i think the society has in some way showed us that technology, engineering, etc are male stuff. [...]
  • Tim: @Trae, my memory fails me. You\'re right I did start blogging in 2004 :) Hmm... so many years gone b [...]
  • trae_z: I started blogging late 2008. For one reason or the other, I lost the first two incarnations of m [...]
  • Tim: That would depend on what application is being built but I did read up uniPaaS and it's worth t [...]

Subscribe to this blog via email

Enter your email address: