使用 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 asorigin/master, origin/dev
, ororigin/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 agit 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 theorigin/master
remote-tracking branch.
上面似乎说 origin/master
指的是本地存储库中的远程跟踪分支。
那么 origin/master
是指远程存储库中的远程分支,还是本地存储库中的远程跟踪分支?什么时候指的是哪个?
最佳答案
您对第一段的评估对我来说似乎是错误的:origin/master
确实指的是您本地的远程跟踪分支。
这由表达式“远程存储库的分支可通过分支名称在克隆中使用...”来暗示。这些是远程分支的本地副本,仅在您获取
时更新,但可以随时在本地访问。
关于git - `origin/master` 是指远程存储库中的远程分支,还是本地存储库中的远程跟踪分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54080029/