0

I have read parsing git log output, preferably as xml but that does not help. I am trying to get the following information about a Git tag.

  1. User that created the tag
  2. Message associated with tag creation if any
  3. The name of the tag (I know this as I already pass this) but I want them in the output so that I can just pass the whole output back to my caller
  4. The latest commit id on that tag

I would prefer them as CSV or space/tab separated values so I was trying to use the --format option. I was trying things like

 git show my_label_name --pretty=format:"%an, %cn" --quiet

but this does not produce what I want. What can I try next?

halfer
  • 19,824
  • 17
  • 99
  • 186
Kannan Ekanath
  • 16,759
  • 22
  • 75
  • 101

1 Answers1

1
git cat-file tag <tag_name>

will give you the actual contents of the file that represents that tag (helpfully unpacked and uncompressed).

Example

$ git init
$ touch README
$ git add README
$ git commit -m 'Initial commit'
$ git tag -a foo -m 'Tagging foo'
$ git cat-file tag foo
object 91654534f5ac138a3adb56a9e6dc3bacae5bae53
type commit
tag foo
tagger Peter Lundgren <peter@peterlundgren.com> 1369779403 -0400

Tagging foo
Peter Lundgren
  • 8,787
  • 2
  • 26
  • 21