How to find all git tags and date-time
October 05, 2021
How to find all git tags and date-time:
I use git tagging to mark a release. It has many advantages like we can move to the codebase for a specific release. We can compare two releases etc.
Find out all tags:
The following command lists all tags for a git repository:
git tag
It will list down all tags for that repository like:
v1.0
v1.0.1
v1.0.2-rc
Search for tags matching a pattern:
We can also search for all git tags that matches a specific pattern. For example,
git tag -l "v1.0.*"
It will list down all tags starts with v1.0. like:
v1.0.0
v1.0.1
v1.0.1-rc1
v1.0.2
List down tags with dates:
You can use the below command to list down all tags with date-time:
git tag -l --format='%(refname) %(creatordate)'
It will print something like below:
refs/tags/v1.0.0 Tue Aug 10 12:39:42 2021 +0530
refs/tags/v1.0 Tue Aug 10 11:26:18 2021 +0530
refs/tags/v1 Tue Aug 10 10:11:11 2021 +0530
Or, you can print in a different format using :short:
git tag -l --format='%(refname:short) %(creatordate:short)'
It will print:
v1.0.0 2021-08-10
v1.0 2021-08-10
v1 2021-08-10