You are using Git and git-svn on a big project which has lots of branches and tags but you only need to work with a small selection of those and you don’t want to import all of the rest.
Import an individual SVN branch
1) Define the new branch in .git/config :
[svn-remote "release-branch"] url = svn+ssh://[email protected]/source/branches/mono-2-2/mcs fetch = :refs/remotes/git-svn-release-branch
2) Import the SVN branch. SVN_BRANCHED_REVISION is the the revision when the branch happened in SVN.
[~]$ git svn fetch release-branch -r SVN_BRANCHED_REVISION
3) Hook up a local Git branch to the remote branch:
[~]$ git branch --track release git-svn-release-branch
5) Checkout and update
[~]$ git checkout release [~]$ git svn rebase
Delete the branch checkout
The following command sequence will delete (locally only) the SVN branch and its history:
[~]$ git branch -D release [~]$ git branch -D -r git-svn-release-branch [~]$ rm -rf .git/svn/git-svn-release-branch [~]$ git gc
Well, for starters given that you are ready to commit something to trunk and you also want to “backport” to the release branch you just have to do:
[~]$ git svn dcommit [~]$ git checkout release && git svn rebase [~]$ git cherry-pick master && git svn dcommit [~]$ git checkout master