What does git describe do, and how does it derive a human-readable name from tags?

Last updated 6 July 2026

  • git describe names a commit by finding the nearest reachable annotated tag and how far past it the commit is, often used to stamp build versions.

  • Output is the tag name if exactly on it, otherwise like v1.2.0-14-g2b1d3c4 (14 commits after the tag, at abbreviated SHA 2b1d3c4).

  • Options: --tags includes lightweight tags, --dirty flags uncommitted changes, --always falls back to a SHA.

  • https://git-scm.com/docs/git-describe
  • https://dev.to/jessekphillips/versions-and-testing-4gck
  • https://dev.to/sergey_shinder_ab2d943365/we-made-checkout-shallow-and-every-build-became-version-010-3cab
  • https://git-scm.com/docs/git-describe/fr
  • https://medium.com/@b.mensing/creating-software-version-numbers-with-git-334d65cd2394
  • https://medium.com/bind-solution/dynamic-version-update-with-git-describe-477e8cd2a306
  • https://dev.to/khozaei/automating-semver-with-git-and-cmake-2hji
  • https://git-scm.com/docs/git-describe/2.0.5
All Git interview questions