Posts /

Svn to git

09 Jun 2013

svn… WHY?!

Sometimes you find svn repositories, yes it happens… Other times you even created them because you were not aware of the existance of git (blame on me). The point is we need to get in into a git repository!

Then how do we do it

Searching a bit on google you find some utilities like subgit or svn2git (which uses git svn). There is also some method that need to use svnadmin but we’ll try to avoid them…

The simpliest way is to use svn2git along with an authors.txt file.

  • First you need to check the authors of commit in the svn repo:
 svn log --quiet | grep "^r" | awk '{print $3}' | sort | uniq

If there are any names with spaces you will need to find them :P * Create and authors.txt file and add every name you found:

 name = Git Name <[email protected]>
  • Then depending on the tree of your svn repo you need to run different commands that can be found in the Readme. If the repo is configured as default with trunk, wiki, doc, etc you just need to do:
 cd git-repo # Go to the directory you want to create the git repo
 svn2git --authors ~/authors.txt http://path-to-repo/svn/ -v

Adding the verbose option (-v) is optional but very recommended to find errors faster if the process fail. Wait, and enjoy your new git repo! Just one Last thing, remember to supress the trunk at the end from your url if you hae the default layout. For local svn repositories do the same as above but use file://<absolute-path-to-repo> instead of the url

Hope it helps!

Twitter Facebook Google+