From: Linus Torvalds <torvalds@linux-foundation.org>
To: Alex Bennee <kernel-hacker@bennee.com>
Cc: git@vger.kernel.org
Subject: Re: How can I easily verify my diffs are in parent branch?
Date: Wed, 4 Apr 2007 08:12:20 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0704040744160.6730@woody.linux-foundation.org> (raw)
In-Reply-To: <1175686583.19898.68.camel@okra.transitives.com>
On Wed, 4 Apr 2007, Alex Bennee wrote:
>
> This is not the case of looking through the logs for my commit as I'm
> exporting my changes from my tree into the company system through CVS.
> This means all the usual commit tracking benefits are lost.
Yeah, sad.
> So I have a master branch which tracks this master baseline from CVS and
> each release I import a big change set which includes all the fixes that
> went into that baseline.
So all your small diffs get smushed in as part of one *big* change? Or do
they still exist in the baseline CVS tree as individual commits?
If they still exist in the CVS tree as individual commits, you're slightly
better off: you can use "git patch-id" to generate a hash of all the
patches, and compare just the hashes. That allows you to efficiently find
patches that have been applied *identically* in both trees.
NOTE! "git-patch-id" generates a hash of a patch by ignoring
- line numbers
- whitespace
- commit comments
so "identical" means just that the patch has to have the exact same
context and +/- patterns, but it will still be considered identical if
it's been moved around (perhaps because some other patch added/removed
code before it) or if the whitespace has been tweaked.
You can then compare the hashes upstream with all the commits *you* cared
about, and see if they are all there. But as noted, this only works if
upstream is expected to actually honor patch-boundaries. If you just get a
single big changeset that contains *all* the changes, doign this obviously
won't work.
NOTE2! I don't think anybody actually *uses* git-patch-id, and what you
should do is to use "git cherry" that does this all internally, but it is
worth understanding *what* git-cherry does.
So to compare all patch-ID's, you can do
git cherry cvs-upstream my-branch
adn it should look at all the commits that are in *your* branch but not
upstream, and report their ID's preceded by a "-" if they are upstream,
and a "+" if they are not.
You can then look at the "+" commits more closely, to see whether maybe
they actually did get merged, but got changed/fixed in the process, or
whether they really are missing.
> Is there an invocation of git-diff or another tool that can tell me all
> my diffs are present in the big uber-commit of my master branch baseline
> release?
If git cherry doesn't work for you, you're kind of screwed and have to do
it manually. Of course, even "manually" can be done with a lot of help
from git.
For example, one thing you can do, if the number of commits you have is
fairly small, is to just be on your "my-branch" and then do
git rebase [--merge] cvs-upstream
which will rebase your "my-branch" onto the CVS upstream thing. It will
automatically discard any patches that get merged away (which effectively
means that they were already there). The end result will be that your
branch will now either be identical to "cvs-upstream" (if everything was
already there) or will contain the commits that weren't there on top of
the new cvs-upstream tip.
NOTE NOTE NOTE! The "git rebase" thing sounds perfect, but the fact is,
quite often you'll end up having to help it do its work. It really
defaults to just trying to apply the patches (ie without "--merge" it's
literally just a fancy
git-format-patch | git am
pipeline).
So "git rebase" may well be the right thing for you, but quite frankly,
it's more likely to work well for simple cases (with no real conflicts
with anybody elses work in the same areas) than for anything complicated.
For complicated stuff, you'll be on your own. "git diff pathname" etc..
Linus
next prev parent reply other threads:[~2007-04-04 15:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 11:36 How can I easily verify my diffs are in parent branch? Alex Bennee
2007-04-04 12:28 ` Alex Riesen
2007-04-04 12:56 ` Andy Parkins
2007-04-04 15:12 ` Linus Torvalds [this message]
2007-04-05 5:25 ` Junio C Hamano
2007-04-05 9:16 ` David Kågedal
2007-04-05 10:24 ` Junio C Hamano
2007-04-05 14:53 ` [PATCH] Document --left-right option to rev-list Brian Gernhardt
2007-04-05 21:37 ` Junio C Hamano
2007-04-07 10:54 ` Alex Riesen
2007-04-09 11:07 ` [PATCH 1/2] git-log --cherry-pick Junio C Hamano
2007-04-10 22:39 ` [PATCH 1/4] Add %m to '--pretty=format:' Junio C Hamano
2007-04-10 22:39 ` [PATCH 2/4] Refactor patch-id filtering out of git-cherry and git-format-patch Junio C Hamano
2007-04-14 8:57 ` Johannes Schindelin
2007-04-10 22:40 ` [PATCH 3/4] git-log --cherry-pick A...B Junio C Hamano
2007-04-10 22:41 ` [PATCH 4/4] Documentation: --cherry-pick Junio C Hamano
2007-04-09 11:11 ` [PATCH 2/2] Add %m to '--pretty=format:' Junio C Hamano
2007-04-11 11:37 ` How can I easily verify my diffs are in parent branch? Alex Bennee
2007-04-11 16:00 ` Linus Torvalds
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.0704040744160.6730@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=kernel-hacker@bennee.com \
/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).