Convert subversion repository to GIT

      No Comments on Convert subversion repository to GIT

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 <>
mattaway = Marshal Attaway <>

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:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.