Migrating a project from one SVN repository to another using git-svn
… sounds probably like a stupid idea since you could just copy the repository from the old to the new location, but in this case we don’t have direct access to the repositories, only accounts with commit-access. Ahh, and we want to preserve the complete history, of course.
Ok, the plan is to use git-svn to get a copy of the old SVN repository, complete with history and then apply each commit to the new location:
Getting the old repository
git svn clone http://old/repo/
cd repo
Removing the traces of the old repository
Now we have a git repository containing the complete history of the old SVN repository. That git repository is connected to the old SVN repository via git-svn. In order to commit it to the new repository we have to remove the traces of git-svn:
# Remove the remote branch
git branch -rD git-svn
# Remove the rest
rm -rf .git/svn/
Edit .git/config and remove the svn-remote
stanza
Commiting into the new repository
Now that we can connect our git repository to the new SVN location and commit all the stuff:
# Create the new repository directory if necessary
svn mkdir http://new/repo/
# Init, fetch, rebase and commit:
git svn init http://new/repo
git svn fetch
git rebase git-svn
git svn dcommit
Maybe not the most elegant solution but it works. The new repository contains everything from the old one, only the commit dates are messed up.