【问题标题】:How to link a subfolder from one git repository into another?如何将子文件夹从一个 git 存储库链接到另一个?
【发布时间】:2019-01-04 05:28:04
【问题描述】:

我在以下结构中有 2 个 git 存储库。

Repository1 -> src
            |
            -> res


 Repository2 -> src
             |
             -> res

我想将 Repository2 中的子文件夹链接到 Repository1,以便最终的文件夹结构类似于:

Repository1 -> src -> Repository2src
            |
            -> res -> Repository2res

有什么办法可以做到吗?

【问题讨论】:

    标签: git git-submodules git-subtree


    【解决方案1】:

    不直接使用 Git,考虑到即使是浅克隆仍会涉及 Repository2 父文件夹(而不是直接使用其 src 或 res 文件夹)。

    我会推荐:

    • Repo1 父 repo,Repo2 声明为 submodule
    • 两个符号链接:
      • Repo1/src/Repository2src 指向 ../Repo2/src
      • Repo2/res/Repository2res 指向 ../Repo2/res

    【讨论】:

      猜你喜欢
      • 2013-02-23
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-25
      • 2015-08-21
      • 2014-10-20
      相关资源
      最近更新 更多