本文介绍了git submodule update --remote vs git pull的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行之间有什么区别
git子模块更新--remote
vs
cd< submodule directoy>
git pull
假设子模块先前设置为跟踪某个分支:
git submodule add -b master [URL to Git repo]
解决方案
区别在于:
-
git pull
只会更新您的子模块分支,但它可以是您可以在该子模块回购库中签出的任何分支。 -
git submodule update --remote
只会更新注册在.gitmodule
中的分支,默认情况下,除非指定了- rebase
或- merge
,否则指定了submodule。$ name.update
设置为rebase
,merge
或none
。
在这两种情况下,您都必须回到父回购,并提交新的子模块SHA1引用。
这是因为在两者中姿态,子模块的SHA1发生变化,这意味着 (,以子模块的根文件夹命名)必须添加并提交。
What is the difference between running
git submodule update --remote
vs
cd <submodule directoy>
git pull
Assuming that the submodule was previously set to track some branch:
git submodule add -b master [URL to Git repo]
解决方案
The difference is:
git pull
will only update your submodule branch, but it can be any branch that you could have checked out yourself in that submodule repo.git submodule update --remote
will only update the branch registered in the.gitmodule
, and by default, you will end up with a detached HEAD, unless--rebase
or--merge
is specified or the keysubmodule.$name.update
is set torebase
,merge
ornone
.
In both cases, you still have to go back to the parent repo, add and commit the new submodule SHA1 reference.
That is because in both instances, the SHA1 of the submodule changes, which means the gitlink (special entry in the index of the parent repo, named after to root folder of the submodule) must be added and committed.
这篇关于git submodule update --remote vs git pull的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!