Migrating svn repository to git


After googling I found this StackOverflow link. First, I needed to install git-svn module.
$ sudo apt-get install git-svn
Now we also need to map svn users to git users. we can get all svn users  ( skip if you already know them) with this command ( execute under svn project root )
$ svn log | grep '^r[0-9]' | awk '{print $3}' | sort | uniq 
Once you get all users, create a users.txt file mapping svn users to git
user1 = first_name last_lame <email@address.com>
user2 = first_name last_lame <email@address.com>
Once you make sure all of your svn users are mapped to git, then execute
$ git svn clone --stdlayout --no-metadata -A users.txt svn://hostname/path dest_dir
It will start fetching svn repository into git. If you run into other problems, like
Author: (no author) not defined in users.txt file 
then simply add following line to users.txt
 (no author) = first_name last_lame <email@address.com>
Note : If, due to this error, git svn command stops then simply update users.txt file and resume the migration
$ git svn fetch 

Now you can transfer your existing git repository to remote git url e.g.
$ git push --mirror git@github.com:username/project.git 



Comments

Popular posts from this blog

getting android emulator to work normally on 64 bit linux

specs 2, Scala and maven with IntelliJ 12.1 and getting things right

me, akka and scala