Given a large Subversion repository with many branches, I want to start using git-svn by cloning trunk first and adding specific branches later. I have seen at least three ways to do this, but are any of them “officially” or is there a better way?
Assume the following location:
https:
So, to clone only that part (without branches) of the revision 12345 of the core project:
$ git svn clone --username=svnuser -r 12345 -Ttrunk https://svn-repo.com/svn/company/core
This will clone the core project into a directory with the same name, and running git svn rebase will change all changes (after version 12345). At this point .git/config should be something like this in it:
[svn-remote "svn"] url = https://svn-repo.com/svn/company fetch = core/trunk:refs/remotes/trunk
So far so good. Now let's say I want to add a playground branch. Here it gets a little foggy.
Option 1 : update the existing remote in .git/config by adding a branch there:
[svn-remote "svn"] url = https://svn-repo.com/svn/company fetch = core/trunk:refs/remotes/trunk branches = core/branches/{playground}:refs/remotes/branches/*
At this point I was able to:
Pull in the revision 23456 branches of the playground
$ git svn fetch -r 23456
Create a local branch and switch to it
$ git checkout -b playground branches/playground
Check out the latest changes:
$ git svn rebase
Option 2 : add a new remote in .git/config (in addition to the existing one):
[svn-remote "playground"] url = https://svn-repo.com/svn/company fetch = core/branches/playground:refs/remotes/playground
Here the steps are similar to the steps from Option 1 :
$ git svn fetch playground -r 23456 $ git checkout -b playground remotes/playground $ git svn rebase
Option 3 I also saw someone adding a new selection to an existing remote:
[svn-remote "svn"] url = https://svn-repo.com/svn/company fetch = core/trunk:refs/remotes/trunk fetch = core/branches/playground:refs/remotes/branches/playground
I'm not quite sure if this is correct or if it will even work. I can not find where I saw it.
I currently adhere to Option 1 , but I would really like to know the most suitable way to do this.