gpt4 book ai didi

git - 使用带有 svn-git 的 TortoiseGit 克隆 SVN 存储库的特定分支

转载 作者:太空狗 更新时间:2023-10-29 13:59:10 25 4
gpt4 key购买 nike

我有一个具有以下架构的 SVN 项目(空 trunktags)

https://svn-repo.com/svn/company
+--my_project
| +--trunk (empty)
| +--branches
| | +--my_branch
| | +--my_branch2
| | +--temp_branch1
| | +--temp_branch2
| | +--temp_branch3
| +-tags (empty)

我想使用 TortoiseGit 将此存储库克隆到具有分支 my_branchmy_branch2 的 git 存储库中,并能够将更改提交回 SVN。

我已经能够通过不选中与主干、标签、分支相关的任何框并将 URL 放入分支来克隆单个分支(例如 https://svn-repo.com/svn/company/my_project/branches/my_branch) 并指定分支的第一个 SVN 修订版。

TortoiseGit clone of SVN single branch

我尝试输入 URL https://svn-repo.com/svn/company/my_project 并选中所有框,但每次都失败。

问题一:如何通过TortoiseGit将SVN仓库及其所有分支克隆到Git?

问题2:如何(如果存在)在Git仓库中只保留某些分支(即删除所有分支temp_branchN)?

我发现了一些 if using git-svn CLI(比如 related topic )但与 TortoiseGit 无关。

非常感谢

最佳答案

  1. 你不能在 TortoiseGit 中(以好的方式)做到这一点
  2. 您必须手动编辑 $GIT_DIR/config 文件中的 [svn-remote] 部分

Git-SVN doc提及 Subversion 存储库的一些罕见情况并提出可能的解决方案:枚举所有需要(并且只需要)的分支

Since some SVN repositories are oddly configured with multiple projects glob expansions such those listed below are allowed:

[svn-remote "project-a"]
...
branches = branches/*/project-a:refs/remotes/project-a/branches/*
branches = branches/release_*:refs/remotes/project-a/branches/release_*
branches = branches/re*se:refs/remotes/project-a/branches/*
...

关于git - 使用带有 svn-git 的 TortoiseGit 克隆 SVN 存储库的特定分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37435121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com