I am a complete git newbie and I want to clone my svn repository using git-svn. However, the branches are missing after the clone command is run.
The repo layout is as follows:
trunk/
branches/team/releases/release-1
branches/team/releases/release-2
...
branches/development/user1/feature1
branches/development/user1/feature2
branches/development/user2/feature3
branches/development/user2/feature4
...
tags/release1
tags/release2
The command I'm using is:
git svn clone --trunk=/trunk --branches=branches/*/* --tags=tags/*/* --prefix=svn/ --authors-file=authors.txt <my-repo> <git-repo-name>
I've tried modifying the branches option to /branches/development/user1/* and /branches/development/user1/*/* (and also using both together) and running the clone command again to see if any additional branches are picked up but they're not.
Is it OK to run clone again or to I have to start from scratch and delete the git repo?
All I can see if I run git branch -r after cloning is:
svn/development/user1
svn/development/user1
svn/team/releases
svn/trunk
note that all the tags are present but omitted for brevity
How do I get the missing branches?
This is not a duplicate of Cloning a Non-Standard Svn Repository with Git-Svn or how to use nested branches through git-svn.
It is in fact possible to do this without re-cloning the entire repository which can take many hours for a large subversion repository. I did this by editing the config file in the .git directory to get my branches and tags setup appropriately.
If you do a plain git svn fetch, nothing will happen. The trick is to trick/force Git to refetch all the revisions:
git svn fetch -r 0:HEAD
This command causes all the tags/branches to be brought in without going through the long and tedious import of the trunk, it was smart enough to skip the trunk revisions already imported in the initial run. I now have my SVN tags/branches in my existing Git repository without a fresh clone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With