如果 git 子模块没有指向最新的提交,如何更新它指向的提交?

How to update the commit a git submodule points to if it does not point at the latest commit?

我 fork 了一个包含一些子模块的 repo。在这些子模块之一中,我想更新代码,然后更新超级项目,使其指向我为修复子模块所做的提交。到目前为止我做了什么:

然而,当我 git clone superproject 并在其中执行 git submodule update --init 时,我仍然得到 'old' 提交而没有我的更改。但是,我需要它来获取包含我的更改的子模块版本,因为它是脚本的一部分。我哪里弄错了?

上面列出的尝试确实奏效了。子项目中的 CMakeLists.txt 总是检出子模块的硬编码提交,这导致了问题。