HEAD Ref


HEAD - Refers to the last commit that the current branch(the current branch refers to the last commit). Therefore HEAD indirectly refences the last commit on the currently branch. It is possible for HEAD to refer to a specific revision that is not associated with a branch name. This situation is called a detached HEAD. For instance, if we can checkout out a specific commit. In this case HEAD would reference the specific commit and not the branch(the last commit). This is know as the head being detached. .git/HEAD

ORIGIN_HEAD - stores the previous HEAD before operations such as reset or merge. It can be used to revert to a previous state. .git/ORIG_HEAD

FETCH_HEAD - Fetches named heads or tags from one or more other repositories. It is used with the git fetch command. It stores the HEAD of all the fetched branches/tags. We can use it to look at the HEADS of the fetch, directly after a git fetch.

MERGE_HEAD - During a merge operation, it stores the HEAD of the branch being MERGED into the current branch.