简体   繁体   English

如何禁用git中的子模块?

[英]How can I disable submodules in git?

I'm trying to make a private mono-repo, with sub packages that have public gits. 我正在尝试制作一个带有公共git子包的私有mono-repo。 At no point do I have any intent of modifying the code outside of my mono-repo, so I have no need for submodules. 在任何时候,我都无意在mono-repo之外修改代码,因此不需要子模块。 In fact, they're the very thing I'm trying to avoid at all costs. 实际上,这是我要不惜一切代价避免的事情。

I don't want to delete the .gits for any of the packages in my mono-repo, and I don't want to do anything fancy. 我不想删除mono-repo中任何软件包的.gits,也不想做任何花哨的事情。

How can I simply disable submodule functionality in git? 如何简单地在git中禁用子模块功能?

I don't ever want anything to be considered a submodule. 我从不希望任何东西被视为子模块。 Never have, and probably never will. 从来没有,也许永远不会。

I've tried searching for some .submodule folder or something in the git. 我尝试在git中搜索某些.submodule文件夹或其他内容。 I found none. 我什么都没找到。 There appears to be no settings to get rid of these things. 似乎没有任何设置可以摆脱这些问题。

I've found this link: un-submodule a git submodule 我找到了此链接: un-submodule git子模块

Unfortunately, these solutions all have to do with flattening submodules, and none of them cover a way to just disable the feature entirely. 不幸的是,所有这些解决方案都与展平子模块有关,它们都没有涵盖完全禁用该功能的方法。

Git doesn't have a feature to disable submodules. Git没有禁用子模块的功能。 They're considered part of the core functionality and Git doesn't have options to disable core functionality like that. 它们被认为是核心功能的一部分,而Git没有禁用此类功能的选项。 It's extremely unlikely that such a feature would be added. 极不可能添加这样的功能。

If you don't want your subrepos to be accidentally be checked in as submodules, you can ignore them, in which case Git won't check them in. If they're already checked in, you can just run git rm --cached DIRECTORY for each submodule and then remove the .gitmodules file, then add them to .gitignore . 如果您不希望将子存储库作为子模块意外签入,则可以忽略它们,在这种情况下,Git不会将其签入。如果已经将它们签入,则可以运行git rm --cached DIRECTORY的每个子模块,然后删除.gitmodules文件,然后将它们添加到.gitignore

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

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