git - 插件 repo 的子模块或 .gitignore?

标签 git github

我已经检查了几个答案,但似乎没有一个符合我正在查看的内容(或者对我来说不太有意义)。

我正在从事一个遵循 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?

What is the advantage of using git submodules over having a repo inside another repo with a gitignore?

最佳答案

子模块的想法是允许父存储库(在您的情况下为 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/

相关文章:

git - 撤消 git 存储

由于新的子模块,git checkout 失败

git - Visual Studio 2010 git 扩展管理远程无法连接

svn - 错误跟踪器/版本控制集成如何与典型的 git 工作流程一起工作?

svn - Github 和 SVN 工作流程

git - 是否有 git gui 工具来检查和提交 cloud9 编辑器中的更改?

macos - 如何防止 NUL 字节出现在我的 GIT 存储库和提交消息中?

git - 从 github 构建 docker 镜像 - 子模块不克隆

github - 使用 Worklight 和 GitHub 进行团队开发

git - git 应该改变行尾吗? (control+M或者第一行末尾的^M)