什么是--“远程”;“实际做什么?”;git子模块更新--remote;?

什么是--“远程”;“实际做什么?”;git子模块更新--remote;?,git,git-submodules,Git,Git Submodules,我只是不理解Git的帮助页面。那么到底发生了什么,或者有什么区别呢 假设我有一个带有子模块B的Git项目a。子模块B确实有一个子模块C。克隆存储库后,a指向B的特定提交,B指向C的特定提交 如果我在A里面,我就乘火车去B cd B 现在我打字 git submodule update --remote 或 有什么区别?假设远程服务器在A、B和C中有更改 我猜使用“git submodule update--remote”会保留对C的特定版本的引用。使用它而不使用--remote会更新到C的最

我只是不理解Git的帮助页面。那么到底发生了什么,或者有什么区别呢

假设我有一个带有子模块B的Git项目a。子模块B确实有一个子模块C。克隆存储库后,a指向B的特定提交,B指向C的特定提交

如果我在A里面,我就乘火车去B

cd B
现在我打字

git submodule update --remote

有什么区别?假设远程服务器在A、B和C中有更改


我猜使用“git submodule update--remote”会保留对C的特定版本的引用。使用它而不使用
--remote
会更新到C的最新版本吗?

假设B是A的唯一子模块

cd A
git ls-tree -r HEAD | grep commit
输出类似于

160000提交0814c6ba8f45829f04709c5611868d2483444c2 foo

foo
是子模块文件夹,
0814c6ba8f45829f04709c5611868d2483444c2
是由A的当前提交跟踪的版本

git子模块更新

cd B
git checkout 0814c6ba8f45829f04709c56118868d2483444c2
git子模块更新--remote
类似

cd B
git fetch origin master
git checkout origin/master

默认情况下,使用
master
origin/master
。如果分支由
.gitmodule
中的
submodule.foo.branch=bar
指定,则使用
bar
origin/bar

在Git中是一个相当新的分支,我是否可以假定永远不应该使用“Git submodule update”,因为我们总是需要最新版本的子模块module@RichardFu视情况而定。在某些情况下,您可能需要最新版本,而在其他情况下,您可能不需要。您能提供参考吗?此信息不在git help子模块中
@CédricVanRompay请参阅和
cd B
git fetch origin master
git checkout origin/master