Convert SVN repository to a GIT repository

Steps I followed to convert my SVN repository to a GIT repository.


[shell] svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt [/shell]

then I editted the authors-transform.txt to have my name fully spelled out and my e-mail address filled in.


[shell] git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp --prefix=origin/ [/shell]

the important part for me was adding the --prefix=origin/. Without this, it all becomes a big mess because?the remote branches will have an empty prefix which makes things harder for you in the future.


To create a .gitignore file based on your svn:ignore properties use the following command:

[shell] cd ~/temp git svn show-ignore -i origin/trunk > .gitignore git add .gitignore git commit -m 'Add .gitignore from svn:ignore properties' [/shell]

Again the critical part for my situation was to add the -i origin/trunk (or --id). Without it it doesn't know what SVN branch you want the properties off.


All of this was shamelessly copied from with some modifications to really make it work, because that post is a little outdated. Credits to John Albin.