I’m trying to move our existing svn repository to git. We don’t need to do any syncing between the two (so no git svn fetches or dcommits) — we’re just moving over and that’s it.
I issued this command to create the git repository:
git svn clone -s https://server/repos/my_repo
This ran fine. However, when I cd‘d into the new my_repo directory, the files that were in there were part of one of the branches (not the trunk).
Doing a git branches -a yields:
* master
modelExperimentalTrunk
modelExperimentalTrunk@719
dRefactoring
reorganise
stableV396
tags/v1.0
trunk
I am on the master branch, but the files that are in my sandbox are actually from the dRefactoring branch (one of our more obscure branches).
Questions:
- Why was the
masterbranch not connected totrunk? - Is there a way to reconnect it to
trunk? Or can that be done during thegit svn clonestage? - Also, given that this is going to be on a server, is there any way
git svncan create a –bare repository?
Reconnecting the master branch to trunk is easy, just run:
This switches to master branch (if this is not already the case) and resets it and the working tree to state of the trunk branch. After this you can safely delete the trunk branch.
git-svn doesn’t support bare repositories out of the box. Read http://gsocblog.jsharpe.net/archives/12 for more details. But I don’t think that you need this complicated solution as you just want to do a single import of your SVN repository.
Therefore you can just create a bare clone of your already existing git repository and you’re set.