Re: my git problem

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

 




On Sun, 27 Apr 2008, Andrew Morton wrote:
> 
> Now, I want to generate a plain patch against mainline which will add the
> patches which are in git-ia64 and which aren't in mainline.  ie: when that
> patch is applied to mainline, we get git-ia64.  Sounds simple.
> 
> A naive
> 
> 	git-diff origin git-ia64

Don't do that.

That will diff between the two branches, and if they both contain stuff 
(which they obviously do), you'll get all the things that are in origin 
(but not git-ia64) as a reversed diff.

What you _want_ is the diff from the last common point, aka the "merge 
base".

With git, you could do that as

	merge_base=$(git merge-base origin git-ia64)
	git diff $merge_base git-ia64

but there is a convenient shorthand for that, which is to use "a...b" 
(three dots!), so

	git diff -p --stat origin...git-ia64

should generally get you what you want.

I say *generally*, because there might be multiple merge-bases if there 
are crossing merges between the two branches and there is no well-defined 
single common point. But that criss-cross case almost never happens for 
the kernel, because I've been pretty good at trying to teach maintainers 
to not generate that kind of complex history (it doesn't just obfuscate 
the above kind of situation, it also makes gitk output harder-to-read than 
it otherwise would be).

That said, your script (that does a merge) should have been able to get 
the diff too, and in fact handle even the criss-cross case. It's written a 
bit strangely (like having that really old-fashioned way of using git 
merge, passing in HEAD explicitly etc).

			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]

  Powered by Linux