我怎样才能从git仓库添加一个特定的文件夹作为git子模块? [英] How can I add a specific folder from a git repo as a git submodule?

查看:1017
本文介绍了我怎样才能从git仓库添加一个特定的文件夹作为git子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆