Migrate from svn to git
Git is becoming more popular in favor of svn, as everyone knows. In this post, we'll show you how to easily migrate from svn to git. Make sure (on ubuntu for example) that you have the git-svn package installed. It should be available from your default repositories.
1. Get all the users whom have worked in your svn repo and save that info to a file
The above code does the following: svn log -q: svn log displays the commit messages. With the -q parameter, you don't show the commit message, only the revision number, author and date.
This part: awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">" processes the svn log output: if the line starts with an 'r', explode the output at the '|' character, remove white spaces and put it between < and >.
This part: sort -u sorts the result and only shows the unique values.
2. Change svn to git users
Git does'nt work with usernames like svn but with e-mail addresses so you have to change the usernames in /tmp/svnusers.txt to the corresponding e-mail addresses.
becomes
3. Clone the svn repo
If your svn repo has the default trunk/branch/tags folders:
otherwise:
4. migrate svn: ignore
5. Create a tag for every tag in svn
6. Create a branch for every branch in svn
7. Remove svn meta-data
8. Push to remote
There you go, everything should be in place ...
If you need more advanced stuff, check it out here: http://www.kernel.org/pub/software/scm/git/docs/git-svn.html