git pull origin master 和 git pull origin/master 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2883840/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Differences between git pull origin master & git pull origin/master
提问by Rachel
What is the difference between git pull origin master
and git pull origin/master
?
git pull origin master
和 和有git pull origin/master
什么区别?
回答by Jakob Borg
git pull origin master
will pull changes from the origin
remote, master
branch and merge them to the local checked-out branch.
git pull origin master
将从origin
远程master
分支中提取更改并将它们合并到本地检出分支。
git pull origin/master
will pull changes from the locally stored branch origin/master
and merge that to the local checked-out branch. The origin/master
branch is essentially a "cached copy" of what was last pulled from origin
, which is why it's called a remote branch in git parlance. This might be somewhat confusing.
git pull origin/master
将从本地存储的分支中提取更改origin/master
并将其合并到本地签出的分支。该origin/master
分支本质上是上次从 中提取的内容的“缓存副本” origin
,这就是为什么在 git 术语中将其称为远程分支的原因。这可能有点令人困惑。
You can see what branches are available with git branch
and git branch -r
to see the "remote branches".
您可以查看哪些分支可用git branch
并git branch -r
查看“远程分支”。
回答by Dhruvil Shah
git pull origin master
will fetch all the changes from the remote's master branch and will merge it into your local.We generally don't use git pull origin/master.We can do the same thing by git merge origin/master
.It will merge all the changes from "cached copy" of origin's master branch into your local branch.In my case git pull origin/master
is throwing the error.
git pull origin master
将从远程的 master 分支中获取所有更改并将其合并到您的本地。我们通常不使用 git pull origin/master。我们可以通过 git pull origin/master 做同样的事情。git merge origin/master
它将合并来自“缓存副本” origin 的 master 分支到你的本地分支。在我的情况下git pull origin/master
是抛出错误。
回答by user33276346
git pull
= git fetch
+ git merge origin/branch
git pull
= git fetch
+git merge origin/branch
git pull
and git pull origin branch
only differ in that the latter will only "update" origin/branch and not all origin/* as git pull
does.
git pull
而git pull origin branch
唯一的区别,后者只会“更新”的由来/支,而不是所有的原产地/ *为git pull
一样。
git pull origin/branch
will just not work because it's trying to do a git fetch origin/branch
which is invalid.
git pull origin/branch
将无法正常工作,因为它正在尝试执行git fetch origin/branch
无效的操作。
Question related: git fetch + git merge origin/master vs git pull origin/master
相关问题:git fetch + git merge origin/master vs git pull origin/master