Git - Head (Head Branch | Branch Head)


This article is about the head, for the HEAD branch see the current branch page.


In the example below, the branch head of:

  • the branch A is the commit CA3
  • the branch B is the commit CB2
CA1--CA2--CA3 <-- Branch A
 CM1--CM2--CM3 <-- master
             CB1--CB2 <-- Branch B



Detached head means you are no longer on a branch, you have checked out a single commit in the history


git checkout master
git checkout yourBranch


Local branch

With the log

git log -n 1 [branch_name]


Local value

local: head of the branchs are stored in the git directory in the log directory

ls .git\logs\refs\heads

remote value

git ls-remote --heads remote
dd39a644a4a7ec3e65135baaf48acd5f7f628510        refs/heads/master
6ead0945771dfd789aa97442ff10872f9665598d        refs/heads/stable
e245797039fa7b86c3a3fb32b45cfb998d8c76cd        refs/heads/v1.13

Reset / revert

Reset, revert to the head commit of the upstream branch

git reset --hard upstream/master

Discover More
Card Puncher Data Processing
Code Versioning - Branch (Line of Development)

The word branch means a line of development. The first one is generally call the master. tree pathhead in git A branch is a sort of sandbox. A branch can be made for: new features to follow the...

is a content-addressable file system used to track directory tree content (as defined by its creator Linux Torvald) It's not a version control...
Git Commit Tree Data Model
Git - Commit

A commit in git is an object that stores the information : who saved the file system snapshots, when they were saved, why they were saved. the commiter the author the parent commit It's...
Git - Current / working / HEAD / active branch

The current or active branch is: the branch checked out actually in the working tree The current branch is also known as the HEAD branch (in uppercase) that represents the last commit known...
Git - Detached HEAD

What means a DETACHED HEAD in git
Git - Fetch (Remote Repository Sync)

A fetch will sync information locally from a remote repository. It will mostly git fetch: download new remote branch download all commits added since the last fetch to the actual branch ( The head...
Git File Lifecycle
Git - File Status

The status of a file in a working directory is one of: where: State Tracked Description untracked New file unmodified Tracked File is the same as in the last commit modified Tracked File...
Git - Local branch

A local branch is a branch that exists only on your computer. tracking branch There are two types of local branches: non-tracking local branches. They are not associated with any other branch....
Git - Objects (Database)

An object is the value in the entry of the git database key-value. All entities in git are objects. Objects are the entity of the Git file system. On the operating file system, the objects are stored...
Git File System
Git - Tree Object

In Git, a tree is an object that corresponds to file system directory in the git file system. A single tree object contains: one or more entries, each of which is the SHA-1 hash of a blob or subtree...

Share this page:
Follow us:
Task Runner