Get the time and date of git tags

后端 未结 7 1306
逝去的感伤
逝去的感伤 2021-01-30 15:37

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

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 16:11

    Note that both of the above solutions get you the commit date, which can be wildly different than when that commit was tagged for release. To get the date of the tag itself, you've got to find the tag itself with rev-parse, read it with cat-file, and then parse it. A little pipeline:

    git rev-parse v1.0.0 | xargs git cat-file -p | egrep '^tagger' | cut -f2 -d '>'

提交回复
热议问题