In the documentation for listing info for git tags, there is field for taggerdate
and creatordate
. What is the difference between these two? Which one indicates the time when the tag was created (annotated to the corresponding commit)?
A tag object has a tagger
field. A commit object has two fields, committer
and author
. When a ref is a tag (refs/tags/v1.2
for instance), it will typically refer:
It's possible for the tag to refer directly or indirectly to a tree or blob, but those are not the interesting cases here.
Use of %(creatordate)
and %(creator)
will grab values from the committer field if the tag is a lightweight tag and hence has no tagger field, but will use the tagger field if the tag is an annotated tag.
Use of %(taggerdate)
grabs only the tagger date field. Use of %(tagger)
grabs only the tagger name-and-email field. If the tag is lightweight and thus has no such fields, these will expand to nothing (empty strings).
Which one indicates the time when the tag was created (annotated to the corresponding commit)?
Only an annotated tag has such data; if the tag is annotated, both %(taggerdate)
and %(creatordate)
will obtain it. If the tag is not annotated, use whichever you want so as to get either the committer date, or nothing.