# Re: previous references

4 messages from 2009-10-04 to 2009-10-05. Participants: Daniele Segato, Sverre Rabbelier, Johan Herland, Octavian Râşniţă.
Thread: https://gitlist.dev/t/21137

## Octavian Râşniţă, 2009-10-04 08:31

Subject: previous references
Message-ID: <8E72DAAF9F8E4024BB819F3F83CCFC79@teddy>
URL: https://gitlist.dev/e/8E72DAAF9F8E4024BB819F3F83CCFC79%40teddy

```
Hi,

Are the following commands specifying the same reference?

prompt> git log -1 HEAD^^^ ... log entry ... 
prompt> git log -1 HEAD^~2 ... log entry ... 
prompt> git log -1 HEAD~1^^ ... log entry ... 
prompt> git log -1 HEAD~3 ... log entry ... 

Thank you.

Octavian


```

## Johan Herland, 2009-10-04 09:27

Subject: Re: previous references
Message-ID: <200910041127.29588.johan@herland.net>
URL: https://gitlist.dev/e/200910041127.29588.johan%40herland.net
In-Reply-To: <8E72DAAF9F8E4024BB819F3F83CCFC79@teddy>

```
On Sunday 04 October 2009, Octavian Râşniţă wrote:
> Are the following commands specifying the same reference?
> 
> prompt> git log -1 HEAD^^^ ... log entry ...
> prompt> git log -1 HEAD^~2 ... log entry ...
> prompt> git log -1 HEAD~1^^ ... log entry ...
> prompt> git log -1 HEAD~3 ... log entry ...

Yes

...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

```

## Daniele Segato, 2009-10-05 21:11

Subject: Re: previous references
Message-ID: <1254777067.26111.105.camel@localhost>
URL: https://gitlist.dev/e/1254777067.26111.105.camel%40localhost
In-Reply-To: <200910041127.29588.johan@herland.net>

```
Il giorno dom, 04/10/2009 alle 11.27 +0200, Johan Herland ha scritto:
> On Sunday 04 October 2009, Octavian Râşniţă wrote:
> > Are the following commands specifying the same reference?
> > 
> > prompt> git log -1 HEAD^^^ ... log entry ...
> > prompt> git log -1 HEAD^~2 ... log entry ...
> > prompt> git log -1 HEAD~1^^ ... log entry ...
> > prompt> git log -1 HEAD~3 ... log entry ...
> 
> Yes

the ~ is used to select the first parent of a commit and their
grand-parents

HEAD~ means the parent of the current head
HEAD~2 means the grand-parent
HEAD~3 the grand-grand-parent..

the ^ is used to select a direct parent of a commit
HEAD^ is the same as HEAD~
HEAD^^ is the same as HEAD~2 (parent of the parent)
HEAD^2 is NOT the same of HEAD~2, it means the "second parent" of HEAD:
this make sense only if HEAD has at least two parents (because it is a
merge commit) if it hasn't you'll get:

fatal: ambiguous argument 'HEAD^2': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions


you can read the same here: http://progit.org/book/ch6-1.html

regards,
Daniele

```

## Sverre Rabbelier, 2009-10-05 21:20

Subject: Re: previous references
Message-ID: <fabb9a1e0910051420q58bded6aqa9510b2cc77a1419@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e0910051420q58bded6aqa9510b2cc77a1419%40mail.gmail.com
In-Reply-To: <1254777067.26111.105.camel@localhost>

```
Heya,

On Mon, Oct 5, 2009 at 23:11, Daniele Segato <daniele.bilug@gmail.com> wrote:
> fatal: ambiguous argument 'HEAD^2': unknown revision or path not in the
> working tree.
> Use '--' to separate paths from revisions

Really? That's awful, shouldn't we at least say something about HEAD
not having that many parents?

-- 
Cheers,

Sverre Rabbelier

```
