From: Michael J Gruber <git@drmicha.warpmail.net>
To: Stefan Haller <lists@haller-berlin.de>
Cc: git@vger.kernel.org
Subject: Re: Interdiff between amended commits
Date: Thu, 14 Apr 2011 09:08:47 +0200 [thread overview]
Message-ID: <4DA69D7F.5050304@drmicha.warpmail.net> (raw)
In-Reply-To: <1jzlxb0.12qxbsl1na9qhzM%lists@haller-berlin.de>
Stefan Haller venit, vidit, dixit 13.04.2011 13:54:
> I'd like to show an interdiff between two commits, e.g. when a commit
> was amended.
>
> I'm aware of the "intercommit" alias in the git wiki:
>
> $ git show commit1 > .git/commit1 && git show commit2 > .git/commit2 && interdiff .git/commit[12]
>
This basically computes the diff between two patches, using a tool which
groks the patch format.
> It only works for simple cases though, and I'd also like to avoid the
> dependency to an external tool if possible.
You could use git diff --no-index instead, so that would work in really
simple cases only, probably.
>
> So one thing I came up with is this:
>
> git checkout commit1^
> git cherry-pick --no-commit commit2
> git diff --cached
That does something completely different. It compares the tree of
commit1^ with the tree of (commit1^ with commit2's patch applied). I
don't see how commit1's patch plays any role here.
Depending on what your actual use case, you may be happier with "git
diff commit1 commit2". Alternatively, you may produce a fake merge with
parents commit1 and commit2 and tree commit1^ and look at "show -R -c"
for that. Sounds weird, I know ;)
Michael
next prev parent reply other threads:[~2011-04-14 7:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-13 11:54 Interdiff between amended commits Stefan Haller
2011-04-14 7:08 ` Michael J Gruber [this message]
2011-04-14 8:09 ` Stefan Haller
2011-04-14 8:47 ` Michael J Gruber
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=4DA69D7F.5050304@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=lists@haller-berlin.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.