我们的 svn 服务器有一个名为 Dev 的主干,分支位于
/Branches/Release/1.0/ /2.0/ /2.3.4/
我用 git svn clone -T Dev ... -b Branches ...
之类的东西克隆了它
当我运行 git branch 2.1 remotes/Release/2.1
我得到:
严重:不是有效的对象名称:'remotes/Release/2.1'。
- 如何引用远程分支?
- 我需要用不同的参数重新克隆吗?
最佳答案
如“How do I import svn branches rooted in different directories into git using git-svn?”中所述,您需要在初始导入期间抓取所有嵌套分支:
[svn-remote "svn"]
url = svn://svnserver/repo
fetch = trunk:refs/remotes/trunk
branches = branches/*/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*
this thread 中也有描述.
对于更复杂的 SVN 分支布局(如 branches within trunk! ),可能需要先修改 SVN 存储库,然后再进行 git-svn 集成。
从 Git1.6 开始,“1.6.x 提供了深度克隆,因此多个通配符可以与 --branches 选项一起使用”,如“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/
关于svn - 如何通过 git-svn 使用嵌套分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3983334/