git 仅显示标记器和标记日期

gen*_*a2x 2 tags git

我希望从通常的 git 存储库中的 git tag 中提取标记者名称和电子邮件。如果我说git show -q <mytag>。git 向我展示了这样的东西:

tag <mytag>
Tagger: tagger <mail>
Date:   tagdate
Tagcomment
commit hash
Author: commitauthor <mail>
Date: commitdate
Commit comment
Run Code Online (Sandbox Code Playgroud)

出于编写脚本的目的,我只需要标记者的邮件和标记日期。我尝试了很多,但找不到任何方法让 git 仅打印此信息。我不想使用grep或其他 shell 工具,也不希望 git 打印完整提交。有任何想法吗?谢谢!

And*_*w C 5

git for-each-ref --format='%(tagger)' refs/tags/$(TAG)
Run Code Online (Sandbox Code Playgroud)

这将提取标记者名称、标记者电子邮件和标记日期。

如果您需要更细粒度的控制,您可以使用taggernametaggerdate等。