Getting a list of authors

First thing was to get a list of users who have committed to SVN. We need this to create an authors file mapping the SVN users to Git users.

$ svn log --quiet | grep "^r" | cut -d'|' -f2 | sort | uniq

After a few minutes it gives a list. After that, I tracked down all those people and created a file that looks like this:

akumar = Atul Kumar <>
byun = Eun-kyu Byun <>
cgsmd1 = Gaurang Mehta <>
cward = Craig Ward <>
dang = Daniel Gunter <>
dkgunter = Daniel Gunter <>
fabio = Fabio Silva <>
gideon = Gideon Juve <>
gmehta = Gaurang Mehta <>
ksb = Keith Beattie <>
mayani = Rajiv Mayani <>
prasanth = Prasanth Thomas <>
rubing = Rubing Duan <>
rynge = Mats Rynge <>
smithd = David Smith <>
vahi = Karan Vahi <>
voeckler = Jens Vöckler <>
wchen = Weiwei Chen <>
wmullins = Bill Mullins <>
(no author) = Pegasus <>

Notice that "(no author)" is mapped to Pegasus. That is a result of the original CVS-SVN conversion, which lost some authorship info.

I saved the list in a file called /tmp/authors.txt

Converting from Subversion to Git

For this step I used a tool called svn2git, which is a wrapper around "git svn" that automates some of the stuff about creating branches. 

It all boils down to something like this:

$ sudo gem install svn2git
$ mkdir pegasus
$ cd pegasus
$ svn2git --verbose --authors /tmp/authors.txt

Cleaning up

svn2git leaves a bunch of cruft in the repository. I just cleaned that stuff manually.

First I had to remove some of the branches:

$ git branch -D monitord@3333
$ git branch -D bill-doc@3339
$ git branch -D pmc_io@5545 
Next, I removed the remote tracking branches for svn:
$ git branch -a | grep remotes/svn | sed 's,remotes/,,' | xargs git branch -d -r
Next, I removed the configuration entries related to the tracking branches by editing .git/config.

Finally, I removed any trace of svn in the .git directory:
rm -rf .git/svn .git/refs/remotes/svn

Creating .gitignore files

Unfortunately, we need to create a bunch of .gitignore files to ignore all of the files that were ignored by svn:ignore properties in Subversion.

First, I got a list of the entries from my svn repository and saved them to a file:

$ svn propget svn:ignore -R > ignores
Next, I wrote a script called svn2git-ignore (attached) that created the .gitignore files:
$ svn2git-ignore SVN_REPO/ignores
$ git add .
$ git commit -m "Add .gitignore files"

Pushing to GitHub

Finally, I pushed everything to my GitHub repository, which I created on

$ git remote add origin
$ git push origin --all
$ git push origin --tags
  • No labels