LinuxCommandLibrary

git-describe

Generate human-readable names for commits

TLDR

Describe current commit

$ git describe
copy
Describe with all tags
$ git describe --tags
copy
Describe specific commit
$ git describe [commit]
copy
Long format always
$ git describe --long
copy
Match tag pattern
$ git describe --match "v*"
copy

SYNOPSIS

git describe [options] [commit]

DESCRIPTION

git describe gives a human-readable name to a commit based on available tags. It finds the most recent tag reachable from the commit and describes the distance from it.
Output format is tag-distance-gSHA, like "v1.0.2-14-g2414721" meaning 14 commits after v1.0.2. If the commit is directly on a tag, just the tag name is returned. This is commonly used for generating version strings in build systems.

PARAMETERS

COMMIT

Commit to describe (default: HEAD).
--tags
Use any tag, not just annotated.
--long
Always output long format.
--match PATTERN
Only consider matching tags.
--abbrev N
Abbreviation length.
--always
Show commit abbrev if no tag found.
--help
Display help information.

CAVEATS

Requires tags in history. Annotated tags preferred by default. Distance counting can be slow.

HISTORY

git describe is a core Git command, essential for generating version strings from repository state.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community