Skip to content

Converting subversion repositories to git

See How to convert from subversion to git by Paul Dowman.

When you use git-svn to clone a subversion repository to git, it converts svn tags to git remote branches. This behavior makes sense if you will continue to use the svn repository. However for permanent conversion I prefer converting them to git tags. The above link is the only howto I found which includes this step.

Here’s a script which echos the required commands to migrate the branches to tags:

for tag in $(git branch -r | grep tags | grep -v @) ; do
  echo git tag $t tags/$t^;
  echo git branch -r -d tags/$t;

To remove the final traces of git-svn:

git config --remove-section svn-remote.svn
rm -rf .git/svn
git branch -r -d trunk

Leave a Reply