How to generate human-readable description of git commit

The following command assumes that you have at least one previous tag in the repository:

git describe --long --tags --dirty

Example output:

v0.1.0-9-g68066f4-dirty

This means that we’re on the 9th commit after the v0.1.0 tag with commit ID g68066f4 and the working tree is dirty, i.e. there are uncommited changes.