« ActionScript 3: Bitwise Flags | Home | Flash/Flex/Flash Lite/Air interface to Zimbra MTA »

December 30, 2008

Migrating from svn to git

We have been using subversion for quite a while but some of us have also used git on personal projects. So, after a couple of discussions we are migrating everything into git. All our repos are password protected and with lots of revisions. This is how we did the migration.

if you surf the web looking for ways to migrate from svn to git you will find lots but none of them manage user authentication on the subversion repo.

I also want to show you a real example of the git benefits when handling file differences efficiently.

If you are on mac OSX like me go and open terminal (or other terminal app with you are on other OS flavor).

We are going to use the git-svn tool to "clone" the subversion repo to create a local git repo.
The "-s" attribute is because our subversion repos are created following the "trunk", "tags" and "branches" folder structure. If you are on google code or other public svn servers this is also what you have.

$ git svn clone -s http://svn.domain.com/repo repo_local_name

If your repo has an authentication enabled by default git will try to use your terminal username. If you want to use a different username try smth like this:

$ git svn clone -s http://svn.domain.com/repo repo_local_name --username=USERNAME

Be sure to replace your USERNAME with the correct one. You will be prompted to insert your password.

In case you receive an error related to Term::ReadKey then be sure to install it:

$ perl -MCPAN -e "shell" cpan> install Term::ReadKey

What happened to me was that cpan could not install Term::ReadKey because of a corrupted installer and so what i did was to compile it manually:

$ wget http://search.cpan.org/CPAN/authors/id/K/KJ/KJALB/TermReadKey-2.14.tar.gz $ tar zxf TermReadKey-2.14.tar.gz $ cd TermReadKey-2.14 $ perl Makefile.PL $ make test $ make install

This is a great example of git that i invite you to try it. I cloned a repo from a django project that we have. Over 2k revisions. It's 51 M, now let's do this:

$ git gc

"gc" stands for garbage collect. It will go through all the folder and download all the stuff that only svn needs because of it's way of handling changes but conserve all the revision history.

After this command the local folder is only 3.1 M :) So nice!

I'm starting to love git and i'm loving it over other systems including p4.

-- fernando

1 Comment

You meant 51 MB! It took me a while to figure it out. Nice indeed, I should give it a try.

How are the Django projects going? Did Pedro forgot PHP already?

Regards to the team!

About this Entry

This page contains a single entry by fernando published on December 30, 2008 4:22 PM.

ActionScript 3: Bitwise Flags was the previous entry in this blog.

Flash/Flex/Flash Lite/Air interface to Zimbra MTA is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.