我的项目结构
ProjectA
-FrameworkA (submodule)
--Twig (submodule of FrameworkA)
如何递归更新子模块?我已经尝试了一些 git 命令(在 ProjectA root 上)
git submodule foreach git pull origin master
或
git submodule foreach --recursive git pull origin master
但无法 pull Twig 的文件。
最佳答案
git submodule update --recursive
您可能还想使用 --init 选项,这将使它初始化任何未初始化的子模块:
git submodule update --init --recursive
注意:在一些旧版本的 Git 中,如果您使用 --init
选项,可能不会更新已经初始化的子模块。在这种情况下,您还应该运行不带 --init
选项的命令。
关于Git递归更新子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10168449/