git - `origin/master` 是指远程存储库中的远程分支,还是本地存储库中的远程跟踪分支?

标签 git version-control branch

使用 Git 进行版本控制

By default, each new clone maintains a link back to its parent repository via a remote called origin. ... Git also configures the default origin remote with a default fetch refspec:

fetch = +refs/heads/*:refs/remotes/origin/*

Establishing this refspec anticipates that you want to continue updating your local repository by fetching changes from the originating repository. In this case, the remote repository’s branches are available in the clone on branch names prefixed with origin/, such as origin/master, origin/dev, or origin/maint.

上面似乎说origin/master指的是远程存储库中的远程分支。

if the alternate histories are in different repositories because of cloning, then the remote branch must be brought into your repository via a fetch operation. You can carry out the operation through a direct git fetch command or as part of a git pull command; it doesn’t matter which. In either case, the fetch brings the remote’s commits, here C and D, into your repository. In no way does the introduction of the alternate history with commits C and D change the history represented by X and Y; the two alternate histories both now exist simultaneously in your repository and form a more complex graph. Your history is represented by your master branch, and the remote history is represented by the origin/master remote-tracking branch.

enter image description here

上面似乎说 origin/master 指的是本地存储库中的远程跟踪分支。

那么 origin/master 是指远程存储库中的远程分支,还是本地存储库中的远程跟踪分支?什么时候指的是哪个?

最佳答案

您对第一段的评估对我来说似乎是错误的:origin/master确实指的是您本地的远程跟踪分支。

这由表达式“远程存储库的分支可通过分支名称在克隆中使用...”来暗示。这些是远程分支的本地副本,仅在您获取时更新,但可以随时在本地访问。

关于git - `origin/master` 是指远程存储库中的远程分支,还是本地存储库中的远程跟踪分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54080029/

相关文章:

php - 使用 ssh 从 github 部署到 linux 服务器但权限被拒绝(公钥)。 PHP脚本

git - 为什么 git svn fetch 这么慢?

git - 在 Git 中删除分支时究竟发生了什么

git - master分支和 'origin/master' fork 了,怎么 'undiverge'分支'?

执行 rebase 后,Git 提交在同一分支中重复

git - 用于恢复多个 git 提交的信息性消息

在 Dockerfile 中使用 SSH 进行 Git 克隆

git - 不在 Git 的 master 分支上工作的原因

git - 是否可以从 `git push` 中排除文件,但将它们保留在本地存储库中?

version-control - 将 .vssscc 和 .vspscc 文件 checkin 源代码管理会出现哪些问题?