Turn your Sourceforge Project into a Git Repo

Unless you’ve been hiding in a cave, you’ve probably heard by now that a lot of open source projects are moving from traditional source control systems like CVS and SVN to distributed systems like git.

Now, especially after attending a presentation by the Github guys at Yahoo  and reading Vlad’s comments on the PITA threshold, I’ve been thinking about moving the Log4perl project from Sourceforge to Github.

But will Github be around five years from now or will there be a better site to host open source projects on? Who knows. But what I know for sure is that I want to use git as a version control system now. It’s not like Log4perl uses a lot of branches, but it drives me crazy that I don’t have the entire project history wherever I am, in a hotel room with bad Internet connectivity or on a plane without any chance of talking to Sourceforge at all.

So what exactly does it take to move your Sourceforge CVS-based project to git? It’s surprisingly simple.

First, install the tools:

$ sudo apt-get install git-core git-cvs

Then, as described in the Sourceforge Help Manual, use rsync to make a ‘backup’ of your CVS root on Sourceforge like

$ mkdir cvsrepo
$ rsync -av log4perl.cvs.sourceforge.net::cvsroot/log4perl/* .

(replace ‘log4perl’ by your Sourceforge project id above) and then create another directory to put your new git repo in like

$ cd ..
$ mkdir gitrepo
$ cd gitrepo
$ git-cvsimport -d `pwd`/../cvsrepo Log-Log4perl

(replace ‘Log-Log4perl’ by the CVS module you want to import into git).

Presto, git starts crunching:


Initialized empty Git repository in /somepath/git/.git/
Counting objects: 5827, done.
Compressing objects: 100% (5237/5237), done.
Writing objects: 100% (5827/5827), done.
Total 5827 (delta 3393), reused 0 (delta 0)
Counting objects: 7546, done.
Compressing objects: 100% (3390/3390), done.
Writing objects: 100% (7546/7546), done.
Total 7546 (delta 4449), reused 5760 (delta 3393)

And after a few seconds (or minutes, depending on the history of your project), you’re done! The entire project history is now in git:

$ git log
commit f63d47a98d58df5c7283f63fefc92c05f4b08f50
Author: mschilli
Date: Fri Mar 20 01:49:25 2009 +0000


is_xxx() returned true prior to L4p initialization. Fixed it
and adapted test suite.


commit ca32d8049c25d2b50ae5a09e06342bd0d95259c6
Author: mschilli
Date: Tue Mar 17 06:35:20 2009 +0000


release notes

Fantastic, I’m in git heaven! Now, let me play around with that a bit, and decide if moving to github makes sense. The reduced PITA factor is a compelling argument. I wonder what the Google boyz are gonna come up with next to stop people leaving Google Code and heading to Github …

Leave a Comment