HEAD不指向当前分支? [英] HEAD doesn't point to the current branch?
问题描述
我想知道,是不是 HEAD
是当前分支?就我而言,它是。但是这表明情况并非如此:
$ $ $ $ $ $ $ $ $ $
$ $ b
所以当前的分支是开发的。但HEAD不是:
pre $ code $ git branch -r
origin / HEAD - >原产地/主产地
产地/开发
产地/主产地
您本地存储库中的HEAD引用当前签出的提交,该提交可能也可能不是分支的位置。因此,本地存储库中的HEAD 不会 始终引用当前检出的分支。例如,您可以通过直接签出提交来输入分离的HEAD状态。
然而,在远程存储库的上下文中,HEAD引用所以
origin / HEAD - >起源/主
表示原点
是主分支。
I wonder, is not HEAD
is the current branch? As far as I'm concerned it is. But this shows that this is not the case:
$ git branch
* develop
master
So the current branch is develop. But HEAD is not:
$ git branch -r
origin/HEAD -> origin/master
origin/develop
origin/master
HEAD in your local repository references the currently checked-out commit, which may or may not also be the location of a branch. So HEAD in a local repository does not always refer to the currently checked-out branch. For example, you can enter a "detached HEAD" state by checking out a commit directly.
However, in the context of remote repositories, HEAD refers to the default branch for that remote. So
origin/HEAD -> origin/master
means that the default branch on origin
is the master branch.
这篇关于HEAD不指向当前分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!