[英]Git, HEAD points to a wrong branch
There is the output of git branch -av
command. 有
git branch -av
命令的输出。 Now I am on the dev
branch. 现在我在
dev
分支。
***dev** 3f126e0 Comment...
master 7a47db8 Another comment...
remotes/origin/HEAD -> origin/master
remotes/origin/dev 3f126e0 Comment...
remotes/origin/master 7a47db8 Another comment...
From the book Pro Git by Scott Checkon. 摘自Scott Checkon的《 Pro Git》一书。
How does Git know what branch you're currently on? It keeps a special pointer called HEAD.
Why does HEAD
point to origin/master
while I am on dev
? 为什么在我从事
dev
时HEAD
为何指向origin/master
?
HEAD
isn't pointing at origin/master
; HEAD
并不指向origin/master
; remotes/origin/HEAD
is pointing at origin/master
. remotes/origin/HEAD
指向origin/master
。
See what HEAD
is pointing at with git symbolic-ref HEAD
. 使用
git symbolic-ref HEAD
查看HEAD
指向什么。
It just tells you that master is the default branch of your remote repository. 它只是告诉您master是远程存储库的默认分支。 But yeah anyway Head is normaly the checked out branch, but in this sittuation it just provides the default branch info.
但是,无论如何,Head通常是已签出的分支,但是在这种情况下,它仅提供默认的分支信息。 Its not that importend anyway.
无论如何它都不是重要的。 A case would be if you clone a repo the default branch gets used.
一种情况是,如果您克隆存储库,则会使用默认分支。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.