Glossaria.net

Glossary Git / Term

detached HEAD

Normally the HEAD stores the name of a branch, and commands that operate on the history HEAD represents operate on the history leading to the tip of the branch the HEAD points at. However, Git also allows you to check out an arbitrary commit that isn’t necessarily the tip of any particular branch. The HEAD in such a state is called "detached".

Note that commands that operate on the history of the current branch(e.g. git commit to build a new history on top of it) still workwhile the HEAD is detached. They update the HEAD to point at the tipof the updated history without affecting any branch. Commands thatupdate or inquire information about the current branch (e.g. gitbranch --set-upstream-to that sets what remote-tracking branch thecurrent branch integrates with) obviously do not work, as there is no(real) current branch to ask about in this state.

Permanent link detached HEAD - Creation date 2023-07-26


< dangling object Glossary / Git directory >