如何通过git-svn使用嵌套分支 [英] how to use nested branches through git-svn
问题描述
我们的svn服务器有一个名为Dev和Branch的中继线。
/Branches/Release/1.0/
/2.0 /
/2.3.4/
我使用类似于的方式克隆它git svn clone -T Dev ... -b分支...
当我运行 git branch 2.1 remotes / Release / 2.1
我得到:
fatal:不是有效的对象名称:'remotes / Release / 2.1'。
- 我如何引用远程分支?
- 是否需要用不同的参数重新克隆?
正如如何使用git-svn?导入以不同目录为根的svn分支到git?,你需要在初始导入期间抓取所有嵌套分支:
[svn-remotesvn]
url = svn :// svnserver / repo
fetch = trunk:refs / remotes / trunk
branches = branches / * / *:refs / remotes / *
tags = tags / *:refs / remotes /标签/ *
这也在 this thread 。
对于更复杂的SVN分支布局(如分支机构内的分支机构!),在进行git-svn集成之前,可以首先对SVN回购进行修改。
由于Git1。 6,1.6.x提供了深层次的克隆,因此多个通配符可以与--branches选项一起使用,如用Git-Svn克隆非标准Svn仓库。
git svn clone https://svn.myrepos.com/myproject web-self-serve --trunk = trunk --branches = branches / * / * --prefix = svn /
our svn server has a trunk called Dev and Branches live in
/Branches/Release/1.0/ /2.0/ /2.3.4/
i cloned it with something like git svn clone -T Dev ... -b Branches ...
when I run git branch 2.1 remotes/Release/2.1
i get:
fatal: Not a valid object name: 'remotes/Release/2.1'.
- How do I refer to the remote branch?
- Do I need to re-clone with different args?
As mentioned in "How do I import svn branches rooted in different directories into git using git-svn?", you need to grab all the nested branch during the initial import:
[svn-remote "svn"]
url = svn://svnserver/repo
fetch = trunk:refs/remotes/trunk
branches = branches/*/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*
That is also described in this thread.
For even more complex SVN branch layout (like branches within trunk!), a modification of the SVN repo might be in order first, before putting in place a git-svn integration.
Since Git1.6, "1.6.x offers deep cloning so that multiple wildcards can be used with the --branches option", as mentioned in "Cloning a Non-Standard Svn Repository with Git-Svn".
git svn clone https://svn.myrepos.com/myproject web-self-serve --trunk=trunk --branches=branches/*/* --prefix=svn/
这篇关于如何通过git-svn使用嵌套分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!