# Commit Hash

> The ID of one commit. It is a long code of letters and numbers.

**Field:** Software Development  
**Category:** Version Control  
**Also known as:** Commit ID, Commit SHA, SHA (Git), Git Hash

## Think of it like

Think of it like a fingerprint. No two commits have the same one.

## Definition

A commit hash is the ID Git gives each commit. Git works it out from the commit's content, its author, its time and its parent. In most repositories it is 40 letters and numbers long. You rarely need it all: the first few characters are usually enough. If anything in a commit changes, its hash changes too.

## Example

Emma tells Jack the bug came in with commit 3f9a1c2. He types git show 3f9a1c2 and sees the change.

## Example code

```console
$ git rev-parse HEAD
3f9a1c27e8b04d5a6c1e2f3b4a5d6e7f8091a2b3
$ git rev-parse --short HEAD
3f9a1c2
```

The full hash of the newest commit, then its short form.

## Why it matters

It is how you point at one exact commit, in a command or in a chat.

## Common mistake

Thinking a hash stays the same after a rebase or an amend. Those make new commits with new hashes.

## Three principles

- **Unique ID.** Each commit gets its own hash.
- **Made from content.** Change the commit, the hash changes.
- **Short is fine.** A few characters usually find it.

## Related terms

- [Commit](https://learn.benibix.com/term/development/commit)
- [Git Log](https://learn.benibix.com/term/development/git-log)
- [Hashing (Cryptography)](https://learn.benibix.com/term/development/hashing)
- [Rebase](https://learn.benibix.com/term/development/rebase)
- [Git Commit Amend](https://learn.benibix.com/term/development/git-commit-amend)

## Taught in

- [Git Log and Git Diff](https://learn.benibix.com/learn/development-version-control/git-log-and-git-diff): Git and GitHub, 3/13

![One commit drawn as a card. At the top, its hash, a long code of letters and numbers, with the first seven characters lit up as the short form. Below it, the author Emma and the date. Then the message: a title line under 50 characters, a blank line, and a body that says why. To the right, git log lists three commits, newest first, each as a short hash and its title.](https://learn.benibix.com/diagrams/dev3-commit-anatomy.svg)

---

Source: https://learn.benibix.com/term/development/commit-hash
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.
