Get the short Git version hash
You can do just about any format you want with --pretty=format:
git log -1 --pretty=format:%h
git log -1 --abbrev-commit
will also do it.
git log --abbrev-commit
will list the log entries with abbreviated SHA-1 checksum.
Try this:
git rev-parse --short HEAD
The command git rev-parse
can do a remarkable number of different things, so you'd need to go through the documentation very carefully to spot that though.