Is there a cleaner way to get the short version hash of HEAD
from Git?
I want to see the same output as I get from:
git log -n 1 | head -n 1 | sed -e 's/^commit //' | head -c 8
I originally used the above command to generate a version string, but this is even better:
git describe --tags
It will output strings like 0.1.12
(tagged commit) or 0.1.11-5-g0c85fbc
(five commits after the tag).
git describe --tags
I get the message, "fatal: No names found, cannot describe anything.".--tags
to work. Try creating a tag first; e.g.git tag 1.0.0
.