Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git terminology: Difference between tip and HEAD?

Tags:

git

What is the difference between the Git HEAD and tip?

Sorry if this has been asked somewhere else.. haven't seen any other questions on this.

like image 513
Marcus Leon Avatar asked Jul 29 '26 09:07

Marcus Leon


1 Answers

From gitglossary (probably accessible via git help glossary on computers with git installed.):

branch
A "branch" is an active line of development. The most recent commit on a branch is referred to as the tip of that branch. The tip of the branch is referenced by a branch head, which moves forward as additional development is done on the branch.

head
A named reference to the commit at the tip of a branch. Heads are stored in a file in $GIT_DIR/refs/heads/ directory, except when using packed refs. (See git-pack-refs[1].)

HEAD
The current branch. In more detail: Your working tree is normally derived from the state of the tree referred to by HEAD. HEAD is a reference to one of the heads in your repository, except when using a detached HEAD, in which case it directly references an arbitrary commit.

With two definitions of "head," differentiated by capitalization, there does seem to be room for confusion. But a quick summary appears to be:

A tip is the most recent commit on a branch. There is one tip per branch.

A head (all lowercase) is somewhat like a tag in that it's a conveniently named reference to the tip of a branch. Unlike a tag, a head will automatically change which commit it references when you add a commit to a branch. There is one head per branch.

The HEAD (all uppercase) is whatever commit you currently have checked out. There is only one HEAD.

like image 84
8bittree Avatar answered Jul 31 '26 22:07

8bittree



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!