Commit a linear git history to subversion


I was recently asked to integrate my local development (which I had done under git management) into our central Subversion server. How to do this while preserving my commit history?


After a lot of reading (and an upgrade to git-1.7.0) I found the following recipe to work for me.

git branch master.bak master
git-svn init svn://repo.domain.local/Project/trunk/sub/directory
git-svn fetch
git checkout -b svnrebase git-svn
git-svn rebase
git rebase --root --onto svnrebase master
git-svn dcommit