“--remote”在 "git submodule update --remote" 中实际做什么?
What does "--remote" actually do in "git submodule update --remote"?
我只是不明白 Git 的帮助页面。那么到底发生了什么或者有什么区别?
假设我有一个带有子模块 B 的 Git 项目 A。子模块 B 确实有一个子模块 C。克隆存储库后,A 指向 B 的特定提交。B 指向特定的提交C.
如果我在 A 里面,我会通过
去 B
cd B
现在我输入
git submodule update --remote
或
git submodule update
有什么区别?假设远程服务器A、B、C确实有变化
我猜测 使用 "git submodule update --remote" 保留对特定版本 C 的引用。是否在没有 --remote
更新到最新版本 C 的情况下使用它?
假设 B 是 A 的唯一子模块。
cd A
git ls-tree -r HEAD | grep commit
输出类似于
160000 commit 0814c6ba8f45829f04709c56118868d2483444c2 foo
foo
是子模块文件夹,0814c6ba8f45829f04709c56118868d2483444c2
是 A 的当前提交跟踪的修订版。
git submodule update
做类似
的事情
cd B
git checkout 0814c6ba8f45829f04709c56118868d2483444c2
git submodule update --remote
就像
cd B
git fetch origin master
git checkout origin/master
默认使用 master
和 origin/master
。如果 .gitmodule
中的 submodule.foo.branch = bar
指定了分支,则使用 bar
和 origin/bar
。
git submodule update --remote
允许您使用子模块的 remote-tracking 分支而不是记录在超级模块中的特定提交(又名。SHA)。
git submodule update
允许您使用超级模块中记录的特定提交。
我只是不明白 Git 的帮助页面。那么到底发生了什么或者有什么区别?
假设我有一个带有子模块 B 的 Git 项目 A。子模块 B 确实有一个子模块 C。克隆存储库后,A 指向 B 的特定提交。B 指向特定的提交C.
如果我在 A 里面,我会通过
去 Bcd B
现在我输入
git submodule update --remote
或
git submodule update
有什么区别?假设远程服务器A、B、C确实有变化
我猜测 使用 "git submodule update --remote" 保留对特定版本 C 的引用。是否在没有 --remote
更新到最新版本 C 的情况下使用它?
假设 B 是 A 的唯一子模块。
cd A
git ls-tree -r HEAD | grep commit
输出类似于
160000 commit 0814c6ba8f45829f04709c56118868d2483444c2 foo
foo
是子模块文件夹,0814c6ba8f45829f04709c56118868d2483444c2
是 A 的当前提交跟踪的修订版。
git submodule update
做类似
cd B
git checkout 0814c6ba8f45829f04709c56118868d2483444c2
git submodule update --remote
就像
cd B
git fetch origin master
git checkout origin/master
默认使用 master
和 origin/master
。如果 .gitmodule
中的 submodule.foo.branch = bar
指定了分支,则使用 bar
和 origin/bar
。
git submodule update --remote
允许您使用子模块的 remote-tracking 分支而不是记录在超级模块中的特定提交(又名。SHA)。
git submodule update
允许您使用超级模块中记录的特定提交。