4

Just curious when you look in the git/refs directory:

.git/refs/heads
.git/refs/tags

why is it called refs/heads instead of refs/branches?

  • 3
    All branches are heads, not all heads are branches. – jessehouwing Sep 16 '19 at 21:13
  • 1
    can you give example of heads that are not branches? thx –  Sep 16 '19 at 21:32
  • 1
    I guess you already read it, but just in case, there's an entry (albeit very concise) in the glossary ([here](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefheadahead)). – Romain Valeri Sep 16 '19 at 21:35
  • From what I've read, it looks like `refs/heads` only contains branch heads. So you're right that it could be `refs/branches`. I could guess the reason, but I wouldn't be able to say for sure. [This link](https://git-scm.com/book/en/v2/Git-Internals-Git-References) basically outright says that `refs/heads` are branches at the end. – Holden Lewis Sep 16 '19 at 23:02
  • 3
    http://www.catb.org/jargon/html/H/hysterical-reasons.html – torek Sep 16 '19 at 23:43
  • 1
    Detached heads for example. – jessehouwing Sep 18 '19 at 09:53

1 Answers1

3

can you give example of heads that are not branches?

A detached head is not a branch.
But all branches are referenced by a HEAD, as direct reference to the last commit of their branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250