有没有办法自动更新 git 子模块?

Seq*_*SEE 2 git git-submodules

我目前在 github 上有一个包含子模块的存储库。为了在任何地方更新子模块,我都会执行 agit pull来拉取主存储库,但必须git pull origin master从子模块的目录中执行 a 才能更新子模块。git pull当我在主项目存储库中执行操作时,有什么方法可以自动更新子模块吗?

ala*_*han 5

man git pull

git pull --recurse-submodules=yes
Run Code Online (Sandbox Code Playgroud)
   --[no-]recurse-submodules[=yes|on-demand|no]
       This option controls if new commits of all populated
       submodules should be fetched and
       updated, too (see git-config(1) and gitmodules(5)).

       If the checkout is done via rebase, local submodule commits 
       are rebased as well.

       If the update is done via merge, 
       the submodule conflicts are resolved and checked out.
Run Code Online (Sandbox Code Playgroud)