Borek Bernard
Borek Bernard

Reputation: 53251

How to use `git describe` on repos without tags?

For most of our repos, we use git describe --tags to print a version number like v1.0.4-14-g2414721. However, this fails if the repo doesn't have any tags yet.

Is there a flag of git describe or something similar that would work around this?

Upvotes: 4

Views: 374

Answers (1)

patthoyts
patthoyts

Reputation: 33203

git-describe offers --always to give a fallback option. If you have any tags those are used, otherwise just the most recent commit id.

Upvotes: 4

Related Questions