git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Andy Parkins <andyparkins@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Commit-ish shortcut for immediate parent range
Date: Sun, 22 Oct 2006 10:25:23 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0610221017180.3962@g5.osdl.org> (raw)
In-Reply-To: <200610221548.42048.andyparkins@gmail.com>



On Sun, 22 Oct 2006, Andy Parkins wrote:
> 
> Git's commit-ish is very powerful.  I was wondering however, if there was a 
> shortcut for (for example)?
> 
>  git-diff 3435fdb4c^..3435fdb4c
> 
> That is - the short range of a particular commit's parent to that commit; like
> 
>  git-diff 3435fdb4c!

Umm. That's not actually a very sensible operation. It's only sensible in 
the special case of "diff", and for that special case, what we do is to 
actually just say that the _command_ is special, not the range.

It's called "git show".

So the thing to do is just

	git show 3435fdb4c

and be happy.

Anyway, there's two kinds of commands wrt revision ranges in git:

 - "git diff"
 - everything else

That may sound strange, but it's true. "git diff" doesn't really do 
"revision ranges". It does "two revision endpoints", which is literally 
very different from just about any other git command. All the other 
commands really think of commits as a "set of individual commits" (where 
sometimes the "set" is admittedly just a single commit).

So the reason for you wanting that "3435fdb4c^..3435fdb4c" is not that 
it's a particularly useful thing in _general_, it's that "git diff" wants 
two endpoints, and you want to have that describe a single commit. 

Hopefully this explains why it's the _command_ that is special, and not 
the range. The range makes no sense.

				Linus

  parent reply	other threads:[~2006-10-22 17:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22 14:48 Commit-ish shortcut for immediate parent range Andy Parkins
2006-10-22 15:11 ` Jakub Narebski
2006-10-22 17:25 ` Linus Torvalds [this message]
2006-10-22 18:25   ` Linus Torvalds
2006-10-22 20:17   ` Andy Parkins
2006-10-22 20:56     ` Linus Torvalds
2006-10-22 21:41       ` Jakub Narebski
2006-10-22 22:09         ` Johannes Schindelin
2006-10-22 22:33           ` Jakub Narebski
2006-10-22 23:36             ` Junio C Hamano
2006-10-23  3:33         ` Linus Torvalds
2006-10-22 20:55   ` Johannes Schindelin
2006-10-22 19:53 ` Jeff King

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=Pine.LNX.4.64.0610221017180.3962@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /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).