In order to get the current commit hash using git you need to use the command: git rev-parse.
For the current commit along with the long hash, use the following:
git rev-parse HEAD
OR
git rev-parse --verify HEAD
To get the short hash, use the following:
git rev-parse --short HEAD
To create hashes for branches and tags, use the following:
git show-ref and git for-each-ref