Recently we converted a few SVN projects to Git. We used a method that converts svn authors to git authors and then uploads the repository to github. It also maintains tags and branches. Here is how we did it:
echo "svnuser <mygithubemail@example.com>" > authors
mkdir myproject-git
cd myproject-git
git svn init -t tags -b branches -T trunk svn+ssh://svnuser@mysvnhost/path/to/svn/repo
git svn fetch --authors-file=../authors
git for-each-ref refs/remotes/tags --shell --format="r=%(refname:short) t=\${r#tags/}" | while read e; do eval "$e"; git tag -f $t refs/remotes/$r; git branch -d -r $r; done
git remote add origin git@github.com:gituser/mygitrepo.git
git push -u origin master
git push --tags |
The git for-each-ref script was taken from gitready.com and converts the tag branches into actual git tags and then delete those branches from the new git repository.
SVN externals will not be imported. In that event, you may find a git mirror of the svn repositories and you can set them up as submodules:
git submodule add git://github.com/path/an-old-svn-external.git vendor/my-new-submodule cd vendor/my-new-submodule git checkout v1.0 cd .. git add my-new-submodule git commit -m "adding submodule at v1.0" git push |
sources: http://stackoverflow.com/questions/1777854/git-submodules-specify-a-branch-tag
If you need to find a specific svn revision number so you can tie your git submodule to the same revision, this will parse all of the git log messages (which will contain the svn revision number of it was imported from an svn repository) and display the revision numbers for you:
git log -z | tr '\n\0' ' \n' | sed 's/\(commit \S*\) .*git-svn-id: svn:[^@]*@\([0-9]*\) .*/\1 r\2/' |


git-svn doesn’t convert ignores and EOLs, unfortunately
See my article about building a writable Git-SVN mirror
http://gitsvn.x10.mx/?p=5
(and of course SVN->Git or Git->SVN conversion is a particular case that can be solved by that approach)