Re: Commit-ish shortcut for immediate parent range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]