# Getting the commit that corresponds to a specific annotated tag

5 messages from 2012-06-01 to 2012-06-01. Participants: Adam Mercer, Junio C Hamano.
Thread: https://gitlist.dev/t/30682

## Adam Mercer, 2012-06-01 21:47

Subject: Getting the commit that corresponds to a specific annotated tag
Message-ID: <CA+mfgz2=ZFBetSGv1Bkq6orBbpVTS1k0gLVm0nGoR1sUDkDwqQ@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2Bmfgz2%3DZFBetSGv1Bkq6orBbpVTS1k0gLVm0nGoR1sUDkDwqQ%40mail.gmail.com

```
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, 2012-06-01 22:00

Subject: Re: Getting the commit that corresponds to a specific annotated tag
Message-ID: <7vd35i1ymz.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd35i1ymz.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CA+mfgz2=ZFBetSGv1Bkq6orBbpVTS1k0gLVm0nGoR1sUDkDwqQ@mail.gmail.com>

```
Adam Mercer <ramercer@gmail.com> writes:

> 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, 2012-06-01 22:11

Subject: Re: Getting the commit that corresponds to a specific annotated tag
Message-ID: <CA+mfgz0GqTKwOg6b=6rPUUnS6kwXZfCCYE7SOVHFcqrjRpOiTw@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2Bmfgz0GqTKwOg6b%3D6rPUUnS6kwXZfCCYE7SOVHFcqrjRpOiTw%40mail.gmail.com
In-Reply-To: <7vd35i1ymz.fsf@alter.siamese.dyndns.org>

```
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?

Cheers

Adam

```

## Junio C Hamano, 2012-06-01 22:21

Subject: Re: Getting the commit that corresponds to a specific annotated tag
Message-ID: <7v8vg61xn5.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v8vg61xn5.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CA+mfgz0GqTKwOg6b=6rPUUnS6kwXZfCCYE7SOVHFcqrjRpOiTw@mail.gmail.com>

```
Adam Mercer <ramercer@gmail.com> writes:

> 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, 2012-06-01 22:27

Subject: Re: Getting the commit that corresponds to a specific annotated tag
Message-ID: <CA+mfgz1DOzB6=m3uLBtAULRZd7TR90M9mDDFFK2dxB+RpWC9kw@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2Bmfgz1DOzB6%3Dm3uLBtAULRZd7TR90M9mDDFFK2dxB%2BRpWC9kw%40mail.gmail.com
In-Reply-To: <7v8vg61xn5.fsf@alter.siamese.dyndns.org>

```
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

```
