问题描述
我有一个git repo,我想为它添加一个子模块。问题是,子模块作为另一个回购站内的文件夹存在。我可以只添加该文件夹作为子模块吗?
I have a git repo and I want to add a submodule to it. Problem is, the submodule exists as a folder inside another repo. Can I add only that folder as a submodule?
推荐答案
如果您确实需要在历史记录中包含其他存储库的一部分您自己的回购,然后比子模块更充分。
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.
这篇关于我怎样才能从git仓库添加一个特定的文件夹作为git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!