简体   繁体   English

将具有多个项目和 svn 外部的 SVN 存储库迁移到 git

[英]Migrate SVN repository with multiple projects and svn externals to git

I'm aware how to migrate a SVN repository which has the following structure我知道如何迁移具有以下结构的 SVN 存储库

SVN Repo1
  + trunk
  + branches
  + tags

I could use the following command我可以使用以下命令

git svn clone svn://hostname/Repo1/ --prefix=svn/ --no-metadata --authors-file "authors-transform.txt" --stdlayout c:\mytempdir

see https://docs.microsoft.com/en-us/azure/devops/repos/git/perform-migration-from-svn-to-git and https://stackoverflow.com/a/3972103/7556646 .请参阅https://docs.microsoft.com/en-us/azure/devops/repos/git/perform-migration-from-svn-to-githttps://stackoverflow.com/a/3972103/7556

But when my SVN repository has the following structure但是当我的 SVN 存储库具有以下结构时

SVN Repo2
  + Project1
      + trunk
      + branches
      + tags
  + Project2
      + trunk
          + Project1 <-- external to ^/Project1/trunk
      + branches
      + tags
  + Project3
      + trunk
          + Project1 <-- external to ^/Project1/trunk
      + branches
      + tags

I've no idea how to convert it to git.我不知道如何将其转换为 git。

Should I migrate each project in Repo2 ?我应该迁移Repo2中的每个项目吗? In that case the svn externals are missing.在这种情况下,缺少 svn 外部组件。 Or is there a way to migrate the hole Repo2 ?或者有没有办法迁移洞Repo2

Remark: A SVN client user was just checking out Project2 or Project3 and not Project1 .备注:SVN 客户端用户只是签出Project2Project3而不是Project1

As far as I know, there is no straightforward way of doing the equivalent of an SVN external in Git.据我所知,没有直接的方法可以在 Git 中进行与 SVN 外部等效的直接方法。 One potential option could be to create a separate repository for Project1 and then use this repository as a submodule inside the Project2 and Project3 directories.一种可能的选择是为 Project1 创建一个单独的存储库,然后将此存储库用作 Project2 和 Project3 目录中的子模块。 This will mean that once code is changed in this new repository for project1 the submodules in both Project2 and Project3 can be easily updated.这意味着一旦在 project1 的这个新存储库中更改了代码,Project2 和 Project3 中的子模块就可以轻松更新。

Here is more info about Submodules这是有关子模块的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM