[Git] Get the current commit hash

Created on November 28, 2026

You can use git rev-parse HEAD to print the hash of the commit checked out in your current working tree.

git rev-parse HEAD

Example output:

63add12a2af05cf81490993e6793a4c22bedbd3b

To print a shortened hash, add the --short option.

git rev-parse --short HEAD

Example output:

63add12a

References

Git