跑步和慢跑有什么区别?
git submodule update --remote
对比
cd <submodule directoy>
git pull
假设子模块之前被设置为跟踪某个分支:git submodule add -b master [URL to Git repo]
跑步和慢跑有什么区别?
git submodule update --remote
对比
cd <submodule directoy>
git pull
假设子模块之前被设置为跟踪某个分支:git submodule add -b master [URL to Git repo]
它们的区别在于:
git pull
仅会更新你的子模块分支,但可以是你在该子模块存储库中自己检出的任何分支。git submodule update --remote
仅会更新在 .gitmodule
中注册的分支,并且默认情况下,你将会得到一个分离的 HEAD,除非指定 --rebase
或 --merge
或者将键 submodule.$name.update
设置为 rebase
、merge
或 none
。在两种情况下,你仍然需要返回到父存储库,添加并提交新的子模块 SHA1 引用。
这是因为在两种情况下,子模块的 SHA1 发生了变化,这意味着父存储库中的gitlink(特殊条目在索引中,以子模块的根文件夹命名)必须被添加并提交。
git submodule update --init --remote
的作用类似于:
git submodule init
:初始化(检出)索引中记录的子模块git submodule update --remote
:一旦子模块已经被初始化(检出),从注册的分支(默认为主分支)拉取更新。