git_get_hash
This script will return the hash of the HEAD commit of the checked out branch of the given Git repository directory ($PWD
if not given).
The suffix -dirty
will be appended if the working tree is dirty.
Usage
$ scripts/git/git_get_hash.sh
844881d148be35d7c0a9bcbf5ba23ab79cf14c6e
$ touch a
$ scripts/git/git_get_hash.sh
844881d148be35d7c0a9bcbf5ba23ab79cf14c6e-dirty