有没有一种方法可以自动更新git子模块?

时间:2020-02-12 17:54:50

标签: git git-submodules

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

1 个答案:

答案 0 :(得分:4)

来自man git pull

git pull --recurse-submodules=yes
   --[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.