在使用 git pull 命令时,如果你的 Git 仓库中包含子模块,你需要使用 --recurse-submodules 或 --recurse-submodules=on-demand 选项来更新子模块。
--recurse-submodules 选项将会递归更新所有子模块,而 --recurse-submodules=on-demand 选项只会在必要时才更新子模块。
使用 --recurse-submodules 选项的命令如下:
git pull --recurse-submodules使用 --recurse-submodules=on-demand 选项的命令如下:
git pull --recurse-submodules=on-demand你也可以在 git config 中设置 submodule.recurse 选项为 true,这样在每次 git pull 时都会自动更新子模块。
git config submodule.recurse true如果你只想更新子模块而不更新主仓库,可以使用 git submodule update 命令。
git submodule update
评论 (0)