Git中的HEAD是什么? [英] What is HEAD in Git?
本文介绍了Git中的HEAD是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b
分支必须在HEAD中完全合并。
但是Git HEAD
究竟是什么?
解决方案
您可以将HEAD视为当前分支。当您使用 git checkout
切换分支时,HEAD版本会更改为指向新分支的提示。
你可以看看HEAD指出了什么:
cat .git / HEAD
在我的例子中,输出是:
$ cat .git / HEAD
ref:refs / heads / master
HEAD引用与分支名称不相关的特定修订。这种情况称为分离的HEAD 。
You see the Git documentation saying things like
The branch must be fully merged in HEAD.
But what is Git
HEAD
exactly?解决方案You can think of the HEAD as the "current branch". When you switch branches with
git checkout
, the HEAD revision changes to point to the tip of the new branch.You can see what HEAD points to by doing:
cat .git/HEAD
In my case, the output is:
$ cat .git/HEAD ref: refs/heads/master
It is possible for HEAD to refer to a specific revision that is not associated with a branch name. This situation is called a detached HEAD.
这篇关于Git中的HEAD是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文