'git submodule update --init --recursive'VS'git submodule foreach --recursive git submodule update --init' [英] 'git submodule update --init --recursive' VS 'git submodule foreach --recursive git submodule update --init'
问题描述
我有嵌套子模块的git repo。下面两条命令有什么区别?
git子模块更新--init --recursive
git子模块foreach --recursive git submodule update --init
git submodule update --init --recursive
子模块 update code>命令将递归到已注册的子模块中,更新和初始化(如果需要)它们以及其中任何嵌套的子模块。
git submodule foreach --recursive git submodule update --init
foreach
将评估每个签出的子模块中的命令。所以它会更新和初始化(如果需要的话)每个子模块和由于 - 递归的任何嵌套子模块。
所以最后,这两个命令都会达到同样的效果。
只是执行不同,第一个命令不会进入每个目录来执行命令。
I have git repo which has nested submodules. What is the difference between below 2 commands?
git submodule update --init --recursive
git submodule foreach --recursive git submodule update --init
git submodule update --init --recursive
The submodule update
command will recurse into the registered submodules, update and init (if required) them and any nested submodules within.
git submodule foreach --recursive git submodule update --init
foreach
will evaluate the command in each checked out submodule. So it will update and init (if required) each submodule and any nested submodules within due to --recursive
.
So in the end, both commands will achieve the same thing. Simply the execution differs, the first command won't step into each directory to execute the command.
这篇关于'git submodule update --init --recursive'VS'git submodule foreach --recursive git submodule update --init'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!