git-svn 分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2974016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:20:19  来源:igfitidea点击:

git-svn branching

svngitgit-svnbranch

提问by slayerIQ

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:

我在 svn 存储库中使用 git 一切正常我用 git 完成了所有分支,所以我没有在 svn 上分支,但我用 git 分支并将这些分支推送到单独的位置。然后我在需要时从分支提交更改。
但现在我想创建一些实际存在于 svn 上的分支,我试过:

$ 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.

我应该如何指定目的地我无法弄清楚,手册页也不是那么清楚。

回答by silk

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 的目录被标记为分支位置。查看你的 .git/config 文件,会有这样的部分:

[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.)

分支将有多个条目。(或者,如果您没有任何分支条目,第一行应该使用标准的 SVN 存储库布局。)

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.

其中最后一个元素是 .git/config 中分支行的目录之一。

回答by VonC

If I read the git svnman pageright:

如果我正确阅读git svn手册页

git svn <command> [options] [arguments]

, you should type:

,你应该输入:

git svn branch -m "message" someFeature 

instead of:

代替:

git svn branch someFeature -m "message"