Is there a way to display last N tags in git?
I am not interested in a pattern because this can change. For example let's say I have these tags and I want to get last 3 of them:
v1.0.0
v1.0.1
v2.0.0
v2.1.0
v3.0.0
Based on the Pro Git seems that this cannot be achieved. Or I am missing something?
This can be done with
git tag --sort
option which is introduced in Git v 2.0.0.Note: I'm using the minus sign
-
to get reverse sorting order (default is oldest to newest).Replace
<number>
with an actual natural number.UNIX, Linux, OS X
From
man head
:Windows, the UNIX way
Windows, native way
(Info on
Select
command was found on serverfault)From git reference: