I have come across this quora question where two answers pointed out that there can be only one head and one answer that there can be more than one HEAD.
Additionally I have found medium article where author stated that there can be any number of heads within a repo ("A repository can contain any number of heads.").
Now I am confused and would be thankful if somebody could please give a hint in this subject.
CodePudding user response:
one answer that there can be more than one HEAD
That answer is referring to the most recent commit of a branch.
They are listed in .git\refs\heads
.
That differs from @
(HEAD), which is in .git/HEAD
, and which represents where you are:
- either a branch
- or a commit ("detached HEAD")
While there can be as many heads there are branches, there can be only one HEAD, since you cannot be at multiple places at once.
Unless you count git worktree list
, which would list multiple working trees attached to the same repository... each with their own HEAD!