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
1 | 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
1 | git-svn init http://svn.somewhere.com/myproject |
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.