git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniele Segato <daniele.bilug@gmail.com>
To: Johan Herland <johan@herland.net>
Cc: "Octavian Râşniţă" <orasnita@gmail.com>, git@vger.kernel.org
Subject: Re: previous references
Date: Mon, 05 Oct 2009 23:11:07 +0200	[thread overview]
Message-ID: <1254777067.26111.105.camel@localhost> (raw)
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

  reply	other threads:[~2009-10-05 21:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-04  8:31 previous references Octavian Râşniţă
2009-10-04  9:27 ` Johan Herland
2009-10-05 21:11   ` Daniele Segato [this message]
2009-10-05 21:20     ` Sverre Rabbelier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1254777067.26111.105.camel@localhost \
    --to=daniele.bilug@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=orasnita@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).