AI Hints
Home›Git & GitHub Tutorial›Reading History
Git & GitHub · Lesson 15 of 144

What a Commit ID Is

The hash.

⏱ 2 min read▶ Video at 15:08🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Every commit has an ID, that long code of letters and numbers. It's called a hash. You'll use it whenever you want to point at one particular commit.

What a Commit ID Is
From the video: What a Commit ID Is
  • Every commit has an ID
  • It's called a hash
  • You use it to point at a commit

What is special about it

Git builds the hash from everything in the commit. The files, the author, the time, the message, and the commit before it. Change any tiny detail, and you'd get a completely different hash. So a hash identifies one exact snapshot, and can never be faked.

Built fromfiles, author, time, message
Uniqueone hash, one snapshot
Tamper-proofany change, new hash
Short formfirst 7 characters

Using a short hash

You don't need the whole thing. The first seven characters are enough. Here, in the short log, we copy the hash of the about page commit. Then git show, with that hash, shows exactly what that commit contained. One new file, about dot HTML, with one line.

git
git log --oneline
f63a17a (HEAD -> main) Link to about page
ef9c947 Add basic styles
6784119 Add about page
0ba6049 Add welcome text
f7d9757 Add home page
git show --stat 6784119
commit 678411907eeca6e9f2c48c417d0c96912d909526
Author: Sam Lee <sam@example.com>
Date:   Mon Jan 5 09:15:59 2026 +0000

    Add about page

 about.html | 1 +
 1 file changed, 1 insertion(+)

Summary

A hash is a commit's unique ID, and the first seven characters are enough to use it. Next, how to see exactly what changed.

Key takeaways
  • A hash is a commit's ID
  • Built from the content
  • First 7 characters work
Next up: Seeing Changes — git diff