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

问题描述 投票:0回答:1

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

git git-submodules
1个回答
2
投票

来自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.
© www.soinside.com 2019 - 2024. All rights reserved.