git rev-parse --short HEAD

Category: Git - Core

git rev-parse --short HEAD

Print the short hash of the current commit

Resolves HEAD to the abbreviated hash Git uses in log output, typically seven characters. Useful for build tags and cache keys in scripts. The length follows core.abbrev or disambiguation rules.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.