svn - 如何通过 git-svn 使用嵌套分支

标签 svn git branch git-svn

我们的 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/

相关文章:

Git 标签保留在 Jenkins 中

svn - 除了从分支合并外,如何锁定 SVN 主干?

eclipse - 'update to HEAD' 的快捷方式

svn - 如何在 SVN 中使用 MSBuild?

git - git:通过提交查看对特定文件的更改

git - 为什么 git clean -dfX 不删除 .gitignore 中的 lib 文件?

linux - Git 检索在分支中修改的所有文件的列表

git - 如何git checkout一个与目录同名的远程分支?

eclipse - 我是否需要将 .groovy 和 .settings 文件夹提交到存储库

svn - 将 vim-diff 配置为在用于 svn-diff 时显示不同的颜色