需要使用“git submodule update”而不是“git pull --recurse-submodules”吗?

需要使用“git submodule update”而不是“git pull --recurse-submodules”吗?

我读了其他类似问题但我觉得我的问题更基本:

来自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.

为了使没有子模块的克隆存储库保持最新状态,我一直在使用git pull。从上面看来,我只需要添加--recurse-submodules即可拉取所有子模块。

git submodule update --recursive但如果是这样,或者或者诸如此类的用处又是什么呢git submodule update --remote --rebase?很抱歉,这让我有些困惑。

git submodule即使我这样做,我是否需要单独执行任何命令git pull --recurse-submodules?我只想与克隆的存储库保持同步。

答案1

由于我没有收到任何回复,我尝试使用 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

相关内容