如何获取 git 子模块从 parent 到 child 存储库的更改?

How do I get git submodule changes from parent to child repository?

我有一个包含子模块(child)的项目仓库(parent)。

在 parent 工作期间,我对 child 的文件进行了更改。我已经在 parent.

中提交了这些更改

如何将这些更改返回到 child?

您需要在子子模块文件夹中添加一个提交更改,您还可以在其中git推回到它自己的上游仓库。

然后你回到父级,添加并提交新的gitlink (special entry in the index,引用子模块的新SHA1),然后推送.

discussion 之后,OP 提到:

/Users/bob/Documents/Web Development/Projects/materialize is a public available theme for the Grav open source CMS.
/Users/bob/Sites/www.materialize.dev is the development version of a private website that uses the theme.

I can't add, commit, and push from the child because edits made in the parent's folder structure do not show as changes in the child, and so there's nothing to commit.
My objective is to develop the website (parent) as a way to develop the theme (child). So I edit in the parent. The theme is published as a complete package on GitHub, the website is not. Am I going about this all in the wrong way from the start?

我确实提到子模块应该能够忽略父仓库正在做的事情(它只是在固定提交时被所述父仓库引用)。
因此,当前的结构可能不适合 OP 所追求的开发类型。