Re: Updated Kernel Hacker's guide to git

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

 



Hi,

[ sorry for breaking up the thread but I'd like to fully
 understand that point and I just subscribed to git mail
 list... ]

Linus Torvalds wrote:

On Wed, 20 Dec 2006, Jay Cliburn wrote:
$ git diff $(git merge-base master driver)..driver

Be careful. This ONLY works if you don't have criss-cross merges etc, so
you need to be somewhat careful about it. If you end up having a complex
merge history between the origin branch and your development tree, things
will stop working

So it's actually worth understanding what the above does.

Here's the picture to keep in mind: you started off with something like
this:

	<- older			newer ->

	..--A---B---C---D

where the top commit was D, and you started doing your own work off there.
However, the tree you are tracking (doing "git fetch origin" or somethng)
ALSO continues, so soon enough you'll have a history that looks like

	<- older			newer ->

	..--A---B---C---D---E---F---G---H <-"origin"
	                 \
	                  --X---Y---Z <- your "driver" branch"

where your work is the "X-Y-Z" sequence.

How, the reason you must NOT do

	git diff origin..driver

or something like that, is that it will LITERALLY do a diff between those
two heads. And while that is a perfectly normal diff, it's not what you
want: it's the diff between the up-stream work and yours, and it will show
that a lot of work has _not_ happened in your branch (all the E-F-G-H
stuff), and then you've added some work (X-Y-Z).

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

?

From the git-rev-list documentation I can read that:

	git-rev-list origin..driver == git-rev-list driver ^origin

I assume it's still true for git-diff. And the documentation says that
the above command "lists all the commits which are included in driver,
but not in origin".

So all commits included in driver are: (A-B-C-D-X-Y-Z)
all commits included in origin are: (A-B-C-D-E-F-G-H)

All the commits which are included in driver, but not in origin are:
(X-Y-Z), which is definitely not what you claimed.

I know that I'm wrong, so please shed some light in my stupid brain.

--
Francis
-
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]