threads / discuss / 30682

Getting the commit that corresponds to a specific annotated tag

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

## tl;dr

5 messages between Jun 1, 2012 and Jun 1, 2012.

replies: 4people: 2as markdown or json

Adam Mercer· Jun 1, 2012, 21:47 UTC · lore
Hi

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?
Cheers
Adam
Junio C Hamano· Jun 1, 2012, 22:00 UTC · re: Adam Mercer · lore

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

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.
Adam Mercer· Jun 1, 2012, 22:11 UTC · re: Junio C Hamano · lore

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

On Fri, Jun 1, 2012 at 5:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
> I think you want
>
>        git rev-parse $tag^{commit}
>
> It's kind of scary, though.
Thanks, that does the trick. Why do you say it's scary?
Cheers
Adam
Junio C Hamano· Jun 1, 2012, 22:21 UTC · re: Adam Mercer · lore

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

Adam Mercer <ramercer@gmail.com> writes:
Show 9 quoted lines
> On Fri, Jun 1, 2012 at 5:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> I think you want
>>
>>        git rev-parse $tag^{commit}
>>
>> It's kind of scary, though.
>
> Thanks, that does the trick. Why do you say it's scary?
Didn't you say you were writing a Porcelain?
Adam Mercer· Jun 1, 2012, 22:27 UTC · re: Junio C Hamano · lore

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

On Fri, Jun 1, 2012 at 5:21 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Didn't you say you were writing a Porcelain?
Ahh, I get you. Porcelain was probably the wrong word...
Cheers
Adam

← back to recent threads