Git · Inspection and internals
git rev-parse
Resolves a ref to a commit hash. Useful in scripts.
Syntax
git rev-parse HEADExample
Example
git rev-parse --short HEAD git rev-parse --abbrev-ref HEAD
More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.