How to show the short version of a revision in Git

To get the short version of a Git revision.

Run the following command:

git rev-parse --short HEAD

The short version is the first 6 character of the sha1 that is the full version.

The following script first gets the current revision for HEAD, then calls the same command for the short revision:

$ git rev-parse HEAD
edc24971b373d63023e30175aacd8fd264cc0584
$ git rev-parse --short HEAD
edc2497
$

References:

Git