Sharing Our Passion for Technology
& continuous learning
〈  Back to Blog

How to commit an existing git project into Subversion

In my last post I mentioned how Git’s stash feature finally convinced me that it made sense in my subversion world. Well, once I was well underway on my new project, I’d reached the point where I was ready to commit version 0.1 to subversion. Googling for how to commit a Git project into Subversion will lead you to a few resources. The one that was spot on with a minor wrinkle was this post. I’ve taken what Brandon posted there and condensed it here with the update for the –root option for the rebase command.

Step 1: Create the project folder in svn with the recommended layout http://my.svnserver.com/repos/myproject http://my.svnserver.com/repos/myproject/trunk http://my.svnserver.com/repos/myproject/tags http://my.svnserver.com/repos/myproject/branches

Step 2: Backup your project’s git repo just in case. From within your project’s root directory run $ git branch master.bak master

Step 3: Link your git repo to the newly created svn location $ git svn init -s http://my.svnserver.com/repos/myproject $ git svn fetch

Step 4: Put all our commits onto the remote trunk repo $ git rebase –onto trunk –root master

Strp 5: Finally commit everything to subversion $ git svn dcommit

All git commits along with the commit history will make it to svn. Except the timestamp of the individual commits will not be preserved.

〈  Back to Blog