Import Git to Subversion October 6, 2009Posted by maxmil in : git , trackback
There are lots of docs out there for how to use git-svn starting with a subversion repository that already exists, however not so many if you are starting with a git repository that you want to import into subversion.
I still consider myself a beginner with git but here is how i managed it.
1) Create and import an empty subversion repository.
svn import tmp http://some/svn/repo -m "Initial import"
2) Clone a git repository from the subversion one you just imported
git svn clone -s http://some/svn/repo/my-project(The -s tells git svn that you are using a standard layout for branches, tags and trunk).
3) Enter your new svn enabled git repository
4) Add your working git repository as a remote repository.
git remote add dev /path/to/working/git/repository
5) Pull all the commits from your working git repository into the master branch of the new repostory.
git pull dev master
6) Rebase these commits ontop of the initial svn commit.
git svn rebase
7) Commit changes to svn.
git svn dcommit (Note that you can use the -n option to check first the commits that are about to be committed).
And that should do it, you can now remove the remote repository dev from your new svn enabled repository and carry on working using git svn dcommit to push local changes to the subversion repository.