git fetch如何解决远程存储库? [英] How does git fetch resolve the remote repository?

查看:95
本文介绍了git fetch如何解决远程存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行git fetch,git如何解决远程问题?

If I run git fetch , how does git resolve the remote ?

git获取文档

在未指定任何远程的情况下,默认情况下,源远程为 使用,除非为当前配置了上游分支 分支.

When no remote is specified, by default the origin remote will be used, unless there’s an upstream branch configured for the current branch.

这是否意味着它将像git push那样参考branch.branchName.remote配置值?

Does that mean it will consult branch.branchName.remote config value like git push ?

对我来说还不是很清楚...unless there’s an upstream branch configured for the current branch是什么意思.文档没有明确说明如果配置了上游,该怎么办?

It is not very clear to me what does it mean ...unless there’s an upstream branch configured for the current branch .The doc does not explicitly says what if upstream is configured ?

更多详细信息:运行git push,pull和fetch没有refspec参数

推荐答案

正如@phd发表在评论中,以及@torek在参考链接的评论中所验证的那样,我代表他们发布答案.

As @phd posted in the comments and as verified by @torek in the comments in reference link, I am posting answer on their behalf.

如果未指定任何远程,默认情况下将使用origin远程,除非为当前分支配置了上游分支,这意味着如果为该分支配置了远程跟踪分支,则它将具有branch.<currentBranchName>.remote它将参考的配置值.

When no remote is specified, by default the origin remote will be used, unless there’s an upstream branch configured for the current branch which means if there is a remote tracking branch configured for that branch , then it will have the branch.<currentBranchName>.remote config value which it will consult.

行为与git push相似,用于在未明确提及的情况下查找存储库.

The behaviour is similar to git push for finding the repository when not mentioned explicitly.

这篇关于git fetch如何解决远程存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆