# Git HEAD

> Git's mark for where you are now: your branch and your commit.

**Field:** Software Development  
**Category:** Version Control  
**Also known as:** HEAD, Detached HEAD

## Think of it like

Think of it like a you are here pin on a map. It shows where you stand right now.

## Definition

HEAD is Git's name for the commit you are on right now. Most of the time it points to a branch, and that branch points to its latest commit. When you switch branches, HEAD moves with you. If you check out an old commit directly, HEAD points at that commit alone, which Git calls a detached HEAD. New commits made there can get lost if you do not put them on a branch.

## Example

Jack switches from main to search. HEAD now points at search, so his next commit lands on that branch.

## Example code

```console
$ cat .git/HEAD
ref: refs/heads/main
```

HEAD is a tiny file that names the branch you are on.

## Why it matters

Every Git command acts on where HEAD is. Knowing it stops commits from landing in the wrong place.

## Common mistake

Making commits in a detached HEAD and then switching away. They are left with no branch and are easy to lose.

## Three principles

- **You are here.** It marks your current commit.
- **Moves with you.** Switching branch moves HEAD.
- **Detached is risky.** Make a branch before you commit.

## Related terms

- [Branch](https://learn.benibix.com/term/development/branch)
- [Commit](https://learn.benibix.com/term/development/commit)
- [Git](https://learn.benibix.com/term/development/git)
- [Git Tag](https://learn.benibix.com/term/development/git-tag)
- [Git Log](https://learn.benibix.com/term/development/git-log)

## Taught in

- [Git Branches and HEAD](https://learn.benibix.com/learn/development-version-control/git-branches-and-head): Git and GitHub, 4/13

---

Source: https://learn.benibix.com/term/development/head
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
