问题描述
我的Wordpress网站由Git进行版本控制,包括 wp-content/plugins/
文件夹.现在有一个插件(wp-editormd),它带有自己的Git存储库, wp-content/plugins/wp-editormd/vendor/jaxsonwang/wp-settings-api-class/
(带有 .git/).Git将其视为子模块,这是不希望的.我担心忽略Git会破坏插件或插件的更新机制.我怎样才能告诉Git它应该像对待普通目录一样对待目录?
My Wordpress site is version-controlled with Git, including the wp-content/plugins/
folder. Now there is a plugin (wp-editormd) that comes with its own Git repository, wp-content/plugins/wp-editormd/vendor/jaxsonwang/wp-settings-api-class/
(with .git/
inside) . Git treats it as a submodule, which is undesired. I am worried that Git-ignoring it could break the plugin or the plugin's update mechanism. How can I tell Git that it should treat the directory like a normal directory?
推荐答案
唯一中断的是子模块文件夹中的历史记录,该历史记录将消失.
The only thing it break is the history inside the submodule folder, which will be gone.
如果它是子模块(记录在 .gitmodules
中),则 git子模块deinit
正确.
If it is a submodule (recorded in the .gitmodules
), a git submodule deinit
is in order.
如果没有,则首先删除 git rm SubmoduleFolder
(无尾随/
)就足够了,以便删除 gitlink(索引中的特殊条目),如.
If not, a git rm SubmoduleFolder
first, (no trailing /
), is enough, in order to remove the gitlink (special entry in the index), as illustrated here.
如果未添加,只需删除嵌套的 .git
文件夹就足够了.
If it was not added, simply removing the nested .git
folder is enough.
然后,您可以像常规文件夹一样添加,提交和推送该文件夹.
Then you can add, commit and push that folder, as a regular one.
这篇关于如何将嵌套存储库(子模块)像普通目录一样对待?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!