git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Getting the commit that corresponds to a specific annotated tag

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2012, 22:00 UTC
Message-ID
<7vd35i1ymz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CA+mfgz2=ZFBetSGv1Bkq6orBbpVTS1k0gLVm0nGoR1sUDkDwqQ@mail.gmail.com>
Adam Mercer <ramercer@gmail.com> writes:
Show 6 quoted lines
> For some porcelain I'm writing I need to determine the commit that
> corresponds to a given annotated tag, so far I have the following:
>
> $ git cat-file tag <tag_name> | grep object | awk '{print $2}'
>
> Is there already some pluming that performs this task?
I think you want
	git rev-parse $tag^{commit}
It's kind of scary, though.
Previous: Adam MercerNext: Adam Mercer
Message 2 of 5 in “Getting the commit that corresponds to a specific annotated tag”
  1. Adam MercerJun 1, 2012
  2. Junio C HamanoJun 1, 2012
  3. Adam MercerJun 1, 2012
  4. Junio C HamanoJun 1, 2012
  5. Adam MercerJun 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.