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>

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

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
  • Daniel: Thanks Tim for coming over! Icant $get that day to me that was like a boost to my skills I was thnki [...]
  • Iyinoluwa Balogun: i think curiousity comes first. those who have left footprints in the sands of time started by quest [...]
  • Kizito S.M.: What I gather is that this G-Buzz is something like a blend between Facebook Updates and Twitter fol [...]
  • concept37: They are trying to out-facebook facebook and out-twitter twitter, Folks who want to do these things [...]
  • ray: Funny u took it from the LBS angle, which makes better sense. But from the social networking perspec [...]

Subscribe to this blog via email

Enter your email address: