为什么在命令“git fetch uploader master”中包含“master”?
在help.github 的分叉项目部分拉取上游更改强>它指出:
一段时间过去了,上游存储库已更改,您希望在提交新补丁之前更新您的分支。有两种方法可以做到这一点:
$ git fetch upstream master
$ git merge upstream/master
为什么在 fetch 命令中包含 master
?我查看了 git help fetch 信息,但我不明白包含 master 的作用。谢谢。
In the section Pulling in upstream changes on help.github's Forking a project it states:
Some time has passed, the upstream repo has changed and you want to update your fork before you submit a new patch. There are two ways to do this:
$ git fetch upstream master
$ git merge upstream/master
Why are they including master
in the fetch command? I've looked at the git help fetch
information but I'm not understanding what including master
does. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这允许您:
git merge
将尝试将上游 master 的本地版本合并到您的 repo master 分支。所以在这里,对于 fetch 命令来说,master 是一个 refspec。
这里,
为空,因此匹配的本地分支(您的主分支)被更新。没有主人,这将给出:
That allows you to:
The
git merge
will then try to merge that local version of the upstream master to your repo master branch.So here, master is, for the
fetch
command, a refspec.Here,
<dst>
is empty, so the matching local branch (your master) is updated.Without master, that would give: