我已经阅读了另一个类似的问题,但我觉得我的问题更基本:
从git pull
联机帮助页:
git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch.
...
--[no-]recurse-submodules[=yes|on-demand|no]
This option controls if new commits of all populated submodules should be fetched and updated, too.
Run Code Online (Sandbox Code Playgroud)
为了使没有子模块的克隆仓库保持最新,我一直只使用git pull
. 从上面看来,我只需要添加--recurse-submodules
即可拉取所有子模块。
但是,如果这样有什么用的git submodule update --recursive
或git submodule update --remote --rebase
或如此,这有点混乱给我,我很抱歉地说。
git submodule
即使我这样做,我是否需要单独执行任何命令git pull --recurse-submodules
?我想要的只是与克隆的 repo 保持同步。
因为我在这里没有得到回复,所以我尝试了 Git 邮件列表,这是我得到的回复:
On Sun, Jun 17, 2018 at 8:41 PM Shriramana Sharma <samjnaa@xxxxxxxxx> wrote:
> Do I need to execute any `git submodule` commands separately even if I
> do `git pull --recurse-submodules`?
Ideally you don't need "git submodule" commands any more, the rest of git
is slowly converging to have builtin submodule functionality.
> All I want is to stay in sync with
> the cloned repo.
That should just work with "pull --recurse"
> But if so what is the use of `git submodule update --recursive` or
> `git submodule update --remote --rebase` or such, which is somewhat
> confusing to me I'm sorry to say.
The git-submodule command was the first command implemented that
dealt with submodules. In the beginning there was no "git pull --recurse"
but the only way was to run "git submodule update" to change
the state of submodules. Now there are better ways to do that, such as
the recursive pull.
Hope that helps,
Stefan
Run Code Online (Sandbox Code Playgroud)