HEAD
is simply where you're currently pointing. This can be either a branch (which is a pointer to a stack of commits) or a commit itself. In the typical usecase, it's going to point to a branch. However, it can also point to a commit (this snippet assumes you're at the root of some git repo):
(base) Matthews-MacBook-Pro:abc matt$ git checkout -b test
Switched to a new branch 'test'
(base) Matthews-MacBook-Pro:abc matt$ cat .git/HEAD
ref: refs/heads/test
(base) Matthews-MacBook-Pro:abc matt$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
(base) Matthews-MacBook-Pro:abc matt$ cat .git/HEAD
ref: refs/heads/master
(base) Matthews-MacBook-Pro:abc matt$ git log -2
commit 5d4fe79e315c302722cfdfef3dd049f720db5acc (HEAD -> master, origin/master, origin/HEAD, test)
Author: Matt Messersmith <nah@blah.com>
Date: Tue Sep 25 20:05:38 2018 -0400
Problem 155 sol.
commit 73cdc8f6a679664e3b92a826377b280aadf31de1
Author: Matt Messersmith <nah@blah.com>
Date: Tue Sep 25 19:47:50 2018 -0400
An easy warmup.
(base) Matthews-MacBook-Pro:abc matt$ git checkout 73cdc8f6a679664e3b92a826377b280aadf31de1
Note: checking out '73cdc8f6a679664e3b92a826377b280aadf31de1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 73cdc8f An easy warmup.
(base) Matthews-MacBook-Pro:leetcode matt$ cat .git/HEAD
73cdc8f6a679664e3b92a826377b280aadf31de1
The difference between a "branch" and "tip of a branch" doesn't really make much sense. It's sort of like asking the difference between a pointer and the tip of the pointer. Branches just point to things (stacks of commits), and HEAD
acts in a similar fashion (can point to a branch or a commit). I suppose it comes down to semantics and linguistics.
HTH!