git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* previous references
@ 2009-10-04  8:31 Octavian Râşniţă
  2009-10-04  9:27 ` Johan Herland
  0 siblings, 1 reply; 4+ messages in thread
From: Octavian Râşniţă @ 2009-10-04  8:31 UTC (permalink / raw)
  To: git

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: previous references
  2009-10-04  8:31 previous references Octavian Râşniţă
@ 2009-10-04  9:27 ` Johan Herland
  2009-10-05 21:11   ` Daniele Segato
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Herland @ 2009-10-04  9:27 UTC (permalink / raw)
  To: Octavian Râşniţă; +Cc: git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: previous references
  2009-10-04  9:27 ` Johan Herland
@ 2009-10-05 21:11   ` Daniele Segato
  2009-10-05 21:20     ` Sverre Rabbelier
  0 siblings, 1 reply; 4+ messages in thread
From: Daniele Segato @ 2009-10-05 21:11 UTC (permalink / raw)
  To: Johan Herland; +Cc: Octavian Râşniţă, git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: previous references
  2009-10-05 21:11   ` Daniele Segato
@ 2009-10-05 21:20     ` Sverre Rabbelier
  0 siblings, 0 replies; 4+ messages in thread
From: Sverre Rabbelier @ 2009-10-05 21:20 UTC (permalink / raw)
  To: Daniele Segato; +Cc: Johan Herland, Octavian Râşniţă, git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-05 21:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-04  8:31 previous references Octavian Râşniţă
2009-10-04  9:27 ` Johan Herland
2009-10-05 21:11   ` Daniele Segato
2009-10-05 21:20     ` Sverre Rabbelier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).