git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Updated Kernel Hacker's guide to git

From
FMFrancis Moreau <francis.moro@gmail.com>
Date
Dec 21, 2006, 12:24 UTC
Message-ID
<38b2ab8a0612210424o4ec5fcd5kb5086c52ccd76491@mail.gmail.com>
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:
Show 39 quoted lines
>
> 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
Next: Linus Torvalds
Message 1 of 12 in “Re: Updated Kernel Hacker's guide to git”
  1. Francis MoreauDec 21, 2006
  2. Linus TorvaldsDec 21, 2006
  3. Carl WorthDec 22, 2006
  4. Linus TorvaldsDec 22, 2006
  5. Carl WorthDec 22, 2006
  6. Linus TorvaldsDec 22, 2006
  7. Junio C HamanoDec 22, 2006
  8. Carl WorthDec 22, 2006
  9. Jakub NarebskiDec 22, 2006
  10. Francis MoreauDec 22, 2006
  11. Junio C HamanoDec 22, 2006
  12. Francis MoreauDec 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.