我已经检查了几个答案,但似乎没有一个符合我正在查看的内容(或者对我来说不太有意义)。
我正在从事一个遵循 Wordpress 模型的项目:
root/
root/core/
root/core/stuff
root/plugins
root/plugins/1
root/plugins/2
整个核心是一个 repo,插件 1、2 等......都是许多不同贡献者的独立 repo。
子模块似乎使问题复杂化——当我想要的只是能够
A)进行更改/推/pull 核心
和
B) 进行更改/推送/pull 插件
以无链接的方式(例如,当我对核心进行提交时,我不关心插件处于什么状态。我宁愿假设在处理核心时插件不存在。)
简单地使用 .gitignore 来忽略整个/plugins/目录不是最直接的吗?
类似问题:
Use gitignore to nest repositories.
Do you ignore a git submodule in your .gitignore or commit it to your repo?
最佳答案
子模块的想法是允许父存储库(在您的情况下为 root
文件夹)记录您在所述父存储库中提交某些内容时所使用的子存储库的确切版本。
这将允许您克隆存储库,知道您将获得子存储库的兼容版本,并使用您当前的文件集。
I don't give a flip what state the plugin is in when I make a commit to the core. I would just rather assume the plugins don't exist while working on core
你可以毫无问题地使用子模块。
在提交和推送 core
时,唯一的额外步骤是返回父 repo,在那里提交和推送(为了记录新的 core
SHA1) .
更多关于“True nature of submodules”的过程。
关于git - 插件 repo 的子模块或 .gitignore?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16334107/