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

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
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.

  1. Interesting. I was looking for this very information.

    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.

    can you explain this command a bit more and how you got it to work?

  2. Pingback: Git First, Git-SVN Later | Lee Hambley

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s