Display an ordered list of Git tags
For the longest time I would run git tag and then scrawl through a long history of tags just to work out which tag I was currently on. This meant scrolling though a list of versions in alphabetical order, like so:
v1.0.0
v1.1.0
v1.10.0
v1.10.1
v1.10.10
v1.10.11
v1.10.12
v1.10.2
v1.2.0
v1.3.0
Alphabetical order might be useful but I usually want to see tags in order of their creation date. The solution is to use the git tag --sort=taggerdate command. This will list the tags in order of the date created:
v1.0.0
v1.1.0
v1.2.0
v1.3.0
v1.10.0
v1.10.1
v1.10.10
v1.10.11
v1.10.12
v1.10.2
Added on 2 November 2020
There is one caveat with using --sort=taggerdate; tags must be annotated in order for it to work. See the documentation on Git tags for more information.
Using --sort=authordate will list the tags in the order of the date created regardless of whether the tags are annotated or not.