Below is a list of helpful commands to run a successful migration of Subversion to Git.
svn log --quiet https://svn-server.example.com/repos/my_repo | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/ //g' | sort | uniq > svnauthors.txt
# convert the `svnauthors.txt` to proper format (name, email) in `authors.txt`
git svn clone --prefix="" --authors-file="authors.txt" -s https://svn-server.example.com/repos/my_repo
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force
git remote add origin ssh://[email protected]/my_username/my_repo.git
git push --all
git push --tags
Sometimes the above does not work as expected and you may have to manually add branches (e.g. those not in standard layout).
svn log --quiet https://svn-server.example.com/repos/my_repo | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/ //g' | sort | uniq > svnauthors.txt
# convert the `svnauthors.txt` to proper format (name, email) in `authors.txt`
git svn init --prefix="" --authors-file="authors.txt" --trunk=trunk --tags=tags https://svn-server.example.com/repos/my_repo
git config --add svn.authorsfile /path/to/authors.txt
git config --add svn-remote.svn.fetch path/to/branches:refs/remotes/only-branch
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --no-delete --force
git remote add origin ssh://[email protected]/my_username/my_repo.git
git push --all
git push --tags
The command above
git config --add
came from this guide.