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)?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With