First, you need to create a file that maps the subversion authors to GIT users (let’s say /tmp/svnusers
). The syntax is pretty easy:
kmartin = Kirk Martin <marty@localhost.com> mattaway = Marshal Attaway <marshal@localhost.com>
To get a list of all your SVN authors, run
$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /'
on you subversion working copy.
Next, you have to create a temp directory (which will be cloned later to get rid of all the SVN stuff).
$ mkdir /tmp/MyProject_tmp $ cd /tmp/MyProject_tmp
Now, you can fetch the SVN files from you subversion server
$ git-svn init svn+ssh://user@SVNHost/MyProject/trunk/ --no-metadata $ git config svn.authorsfile /tmp/svnusers $ git-svn fetch
Please note, that you may need to adjust the protocol (svn+ssh, http, https, ftp, etc.), user, host, path to the project files etc.
To get rid of all the SVN remains, simply clone the newly created GIT repo
$ git clone MyProject_tmp MyProject
Resources and further reading:
http://progit.org/book/ch8-2.html
http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/