Geeks Are Boring…

Main menu

Post navigation

git first, git-svn later.

the whole story is that I started a project locally and I used git as my SCM. now I’m going to put it into a svn repository with full history but I still want to use git.

normally you should make this decision at the beginning. that means you

git-svn clone http://svn.somewhere.com/myproject

first, then you use git as usual, do git-svn rebase and git-svn dcommit. you have to do this because git-svn must know where to start, namely you should have at least one git-svn-id in your git log to start with.

here is how I add svn support into an existing git repository. basically it’s easy, you just

git-svn init http://svn.somewhere.com/myproject
git-svn fetch

now git branch -r should tell you there is a branch called git-svn. you git rebase git-svn your current master. if it succeeded then you’re all set.

however, in order to do this, there must be a point back in time that these two branches are the same. if it’s not the case, you’re in trouble. you have to use git-svn set-tree to force a svn commit to be your starting point. in my case, the svn repository started out empty, so I forced the first commit in my git. after that git rebase succeeded like I expected.

2 thoughts on “git first, git-svn later.”

Unfortunately, I can’t seem to get the git-svn set-tree command to work.

I have a blank SVN repository that I’m looking to push my local git repository into. I was able to do the git-svn init and git-svn fetch fine but I can’t seem to do a dcommit. I don’t have the remote git-svn branch in my list and I can’t get the set-tree command right.