git-svn branching

2019-01-22 02:11发布

问题:

I am using git with an svn repository everything is going fine I did all my branching with git so I did not branch on svn but I branched with git and pushed those branches to a separate location. Then I commited changes from the branch when needed.
But now I want to create some branches that actually exist on svn I tried:

$ git svn branch someFeature -m "message" 

,and I got this:

$ git svn branch someFeature -m "message"  
Multiple branch paths defined for Subversion repository. 
You must specify where you want to create the branch with the 
  --destination argument.

How should I specify the destination I can't figure this out and the man page isn't that clear also.

回答1:

You have multiple (or no) directories from svn marked as place for branches. Look into you .git/config file, there would be section like that:

[svn-remote "svn"]
url = file:///someurlto/svn
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
branches = branches2/*:refs/remotes/*

There will be multiple entries for branches. (Alternately, if you don't have any branch entries, the first line should work with a standard SVN repo layout.)

So, when branching you must point in which directory the branch should be created:

git svn branch someFeature -m "test" --destination branches2

where the last element is one of the directories from branches lines in .git/config.



回答2:

If I read the git svn man page right:

git svn <command> [options] [arguments]

, you should type:

git svn branch -m "message" someFeature 

instead of:

git svn branch someFeature -m "message"