git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Francis Moreau <francis.moro@gmail.com>
Cc: Jay Cliburn <jacliburn@bellsouth.net>,
	git@vger.kernel.org, Jeff Garzik <jeff@garzik.org>
Subject: Re: Updated Kernel Hacker's guide to git
Date: Thu, 21 Dec 2006 10:23:30 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0612211013500.3394@woody.osdl.org> (raw)
In-Reply-To: <38b2ab8a0612210424o4ec5fcd5kb5086c52ccd76491@mail.gmail.com>



On Thu, 21 Dec 2006, Francis Moreau wrote:
> 
> I must really miss something but is a diff between origin and driver heads
> achieved by:
> 
> 	$ git diff driver origin
> 
> instead of:
> 
> 	$ git diff origin..driver

No. 

	git diff origin driver

and

	git diff origin..driver

is exactly the same thing.

> From the git-rev-list documentation I can read that:
> 
> 	git-rev-list origin..driver == git-rev-list driver ^origin

Correct. However, "git diff" is very aware of things like "^origin", and 
understands that

	git diff driver ^origin

is the same thing as saying "I want what is in driver, but not in origin", 
so it needs to switch the arguments.

In short, for git diff (and ONLY) git diff, all of these are the same:

	git diff a..b
	git diff a b
	git diff b ^a

[ ADDITIONALLY git diff _also_ has a magic special case of

	git diff a b ^c

  which actually means the same as "git diff c..a" (and "b" is 
  totally ignored). That may sound strange, but it's because the 
  expression "a...b" means "b a --not $(git-merge-base a b)", and so what 
  you actually WANT is that if you do

	git diff a...b

  you should get "diff from merge-base to b", so when "a...b" expands to 
  "b a ^merge-base", then git understands that if it gets that stange 
  command line with THREE commits, and one of them is negated, you really 
  wanted the diff from the negated one to the first one ]

It basically all boils down to:

	"git diff" is special

exactly because unlike almost ALL other git commands, "git diff" does not 
work on a _list_ of commits, it only works on two end-points. That means 
that the "list operations" actually end up meaning something else for git 
diff than they do for "git log" and friends.

		Linus

  reply	other threads:[~2006-12-21 18:23 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 12:24 Updated Kernel Hacker's guide to git Francis Moreau
2006-12-21 18:23 ` Linus Torvalds [this message]
2006-12-22  1:23   ` Carl Worth
2006-12-22  4:13     ` Linus Torvalds
2006-12-22 22:20       ` Carl Worth
2006-12-22 22:34         ` Linus Torvalds
2006-12-22 22:45         ` Junio C Hamano
2006-12-22 23:31           ` Carl Worth
2006-12-22 23:00         ` Jakub Narebski
2006-12-22  9:35   ` Francis Moreau
2006-12-22 10:26     ` Junio C Hamano
2006-12-22 20:34       ` Francis Moreau
  -- strict thread matches above, loose matches on Subject: below --
2006-12-21  3:04 Jeff Garzik
2006-12-21  3:21 ` Jay Cliburn
2006-12-21  7:04   ` Martin Langhoff
2006-12-21  7:32     ` Junio C Hamano
2006-12-21  7:51   ` Linus Torvalds
2006-12-21 11:53   ` Jeff Garzik
2006-12-21  5:44 ` Willy Tarreau
2006-12-21  5:53 ` Nigel Cunningham
2006-12-21 11:44   ` Jeff Garzik
2006-12-21 21:17     ` Nigel Cunningham
2006-12-21 13:53 ` Francois Romieu
2006-12-21 20:40 ` Guennadi Liakhovetski
2006-12-21 20:46   ` Jeff Garzik
2006-12-22  8:50 ` Jesper Juhl
2006-12-24 18:07 ` Horst H. von Brand
2007-12-23 11:13   ` Jeff Garzik
2007-12-23 12:08     ` Robert P. J. Day
2007-12-23 12:13       ` Jeff Garzik
2007-12-23 12:20         ` Robert P. J. Day
2007-12-23 13:05           ` Dieter Ries
2007-12-23 17:23             ` Robert P. J. Day
2007-12-23 20:14             ` Stefan Richter
2007-12-24 14:19             ` Robert P. J. Day
2007-12-23 12:25     ` WANG Cong
2007-12-24 12:50     ` Miklos Vajna
2007-12-25 13:08     ` Salikh Zakirov
2007-12-31  2:50     ` Jan Engelhardt
2007-12-31 11:26       ` Stefan Richter
2007-12-31 17:31         ` Junio C Hamano
2008-06-30  2:51         ` Jeff Garzik
2008-06-30  6:27           ` Stefan Richter
2008-06-30  2:49       ` Jeff Garzik
2008-07-03  6:26         ` Christian Couder

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.0612211013500.3394@woody.osdl.org \
    --to=torvalds@osdl.org \
    --cc=francis.moro@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jacliburn@bellsouth.net \
    --cc=jeff@garzik.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).