Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the time and date of git tags

I have a project that is using git and have tagged all the releases with a tag.

$ git tag v1.0.0 v1.0.1 v1.0.2 v1.0.3 v1.1.0 

My goal is to list the releases and release dates in a web interface (tag/commit date = release date). Currently we list all the releases by using git tag.

How can I get the time and date for when the tag was made (or the commit it points to)?

like image 250
HNygard Avatar asked Nov 03 '12 11:11

HNygard


People also ask

How do I see git tags?

Listing the available tags in Git is straightforward. Just type git tag (with optional -l or --list ). You can also search for tags that match a particular pattern. The command finds the most recent tag that is reachable from a commit.

Do git commits have timestamps?

There are actually two different timestamps recorded by Git for each commit: the author date and the commit date. When the commit is created both the timestamps are set to the current time of the machine where the commit was made.


1 Answers

This always worked for me:

git log --tags --simplify-by-decoration --pretty="format:%ci %d" 

Consult the "PRETTY FORMATS" section of the git-log manpage for details of the format string if you want a different date formatting.

like image 85
Nikos C. Avatar answered Oct 02 '22 03:10

Nikos C.