Git commit ID is essentially a SHA-1 hash 40 characters string that looks like
c1e5a0931989d842d00b8c07a5aacfe75ff39fcc. However, here’s some practical nugget I wanna share with you on how to get the current Git commit ID.
Go to your repo directory and run the following command:
git rev-parse HEAD
To get the short version of the commit hash, run:
git rev-parse --short HEAD
We all know that SHA-1 is pretty old and has long been known to be vulnerable, so Git introduced experimental support for SHA-256 two years ago in Git version 2.29 which might be topic for another day.
To find more neat Git commands and hacks, browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.