且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我怎样才能从git仓库添加一个特定的文件夹作为git子模块?

更新时间:2021-09-01 05:35:18

如果您确实需要在历史记录中包含其他存储库的一部分您自己的回购,然后子树合并战略比子模块更充分。

If you really need to include part of an other repository within the history of your own repo, then the subtree merge strategy is more adequate than submodules.

但是在这两种情况下,完整的存储库都与您的仓库链接,而不仅仅是一个目录。

部分克隆不可能

But in both case, the full repository is linked to your repo, not just one directory.
And partial cloning is not possible.

您可以尝试并隔离该目录,然后将其添加为子模块,但这意味着它的历史记录将完全与它原来的回购单独分开。

You could try and isolate that directory in its own repository, and then add it as a submodule, but that means its history will be totally seperated from the repo its was coming from originally.