1

Mercurial have command to determine if we at tag release or how far from it:

hg log -r . --template '{latesttagdistance}'
hg log -r . --template '{latesttag}'

Is there a way to get latest tag for working directory and how far we from latest tag for Git?

When I get some GitHub code I usually use tagged version instead of master to avoid inconsistent/transient state. I look to list of git tag -n1 -l by eyes and this is error-prone.

gavenkoa
  • 45,285
  • 19
  • 251
  • 303

1 Answers1

3

The command git describe gives what you want, by showing the nearest annotated tag, git describe --tags or git describe --all also consider non annotated ones, see the documentation for the gory details.

vonbrand
  • 11,412
  • 8
  • 32
  • 52