git tag -l ac* | tail -n1
Get the last tag with prefix "ac". For example, tag named with ac1.0.0
, or ac1.0.5
. Other tags named 1.0.0
, 1.1.0
will be ignored.
git tag -l [0-9].* | tail -n1
Get the last tag, whose first char is 0-9
. So, those tags with first char a-z
will be ignored.
git tag --help # Help for `git tag`
git tag -l <pattern>
List tags with names that match the given pattern (or all if no pattern is given). Running "git tag" without arguments also lists all tags. The pattern is a shell wildcard (i.e., matched using fnmatch(3)). Multiple patterns may be given; if any of them matches, the tag is shown.
tail -n <number> # display the last part of a file
tail -n1 # Display the last item
With git tag --help
, about the sort
argument. It will use lexicorgraphic order
by default, if tag.sort
property doesn't exist.
Sort order defaults to the value configured for the tag.sort variable if it exists, or lexicographic order otherwise. See git-config(1).
After google, someone said git 2.8.0 support following syntax.
git tag --sort=committerdate