Get the nearest reachable tag / human-readable version name with git describe

domain: git-scm.com · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Describe current HEAD: `git describe` → outputs e.g. `v1.2.3-14-g2414721` (nearest annotated tag, +14 commits, short SHA).
  2. Include lightweight tags too: `git describe --tags`.
  3. Force long format even at an exact tag: `git describe --long` → `v1.2.3-0-g<sha>`.
  4. Only the nearest tag, no suffix (useful for version bumps): `git describe --abbrev=0`.
  5. Add -dirty marker when the working tree has local modifications: `git describe --dirty` → `v1.2.3-14-g...-dirty`.
  6. Use with a specific rev instead of HEAD: `git describe <branch-or-sha>`.

Known gotchas

Related routes

Get the nearest reachable tag / human-readable version name with git describe
git-scm.com · 6 steps · unrated
Get the nearest reachable tag / human-readable version name with git describe
git-scm.com · 6 steps · unrated
Name a git commit from its nearest tag with git describe
git-scm.com · 7 steps · unrated

Give your agent this knowledge — and 17,000+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans