List git tags in chronological order

The default behaviour in git, at least on my Mac, for the command git tag is to list tags in alphabetical order, e.g:

v1.10.1
v1.7.15
v1.7.16
v1.7.17
v1.7.18
v1.7.19

This is quite a counter-intuitive output because if the list is quite long, a user, or myself in the future could very well miss v1.10.1 and create the next tag as v1.7.20. One way to get the list in the right order is to instead use the following:

git tag --sort=committerdate

Now we can see the correct list:

v1.9.23
v1.9.24
v1.9.25
v1.9.26
v1.10.1

If you want to create an alias for that, use the following:

git config --global alias.t 'tag --sort=committerdate'

You’ll now be able to do git t and have your list of tags in the right order.

References: