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

发布于 2024-09-28 16:39:08 字数 343 浏览 0 评论 0原文

我们的 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'。

  • 如何引用远程分支?
  • 我需要使用不同的参数重新克隆吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里寻她 2024-10-05 16:39:08

如“如何使用 git-svn 将植根于不同目录的 svn 分支导入到 git 中?",您需要在初始导入期间抓取所有嵌套分支:

[svn-remote "svn"]
    url = svn://svnserver/repo
    fetch = trunk:refs/remotes/trunk
    branches = branches/*/*:refs/remotes/*
    tags = tags/*:refs/remotes/tags/*

此线程
对于更复杂的 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/

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/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文