Reputation: 56669
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.
Upvotes: 7
Views: 2309
Reputation: 1799
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
.
Upvotes: 9