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

Re: Interdiff between amended commits

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 14, 2011, 08:47 UTC
Message-ID
<4DA6B4AE.1090701@drmicha.warpmail.net>
In-Reply-To
<1jzpkig.1g2zjmtgv7a68M%lists@haller-berlin.de>
Stefan Haller venit, vidit, dixit 14.04.2011 10:09:
Show 39 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> wrote:
> 
>>> 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.
> 
> Sorry, that was just a typo.  I meant
> 
>   git diff --cached commit1
> 
> as the last line, of course.
> 
> Alternatively, I could do it the other way round, by saying
> 
>   git checkout commit2^
>   git cherry-pick --no-commit commit1
>   git diff --cached -R commit2
> 
> That should produce the same result (except maybe for the line numbers
> in the hunk headers), as long as the cherry-pick didn't have conflicts.
> 
>> Depending on what your actual use case, you may be happier with "git
>> diff commit1 commit2"
> 
> No, that's not what I want (except when commit1 and commit2 have the
> same parent).  This would also show the differences between the parents
> of commit1 and commit2; I don't want to include those.
> 
> My actual use case is that I have a central repository that sends out
> commit emails; when someone does an interactive rebase and amends a
> commit in the middle of a branch, I want to match up corresponding
> commits based on their subject line, and then send an email showing how
> the diff for that commit changed.

In that case, "git diff --no-index" on the two patches (i.e. the alias you found with "interdiff" replaced) may be worth a try. We should be able to teach our diff machinery about our diffs :) I mean, see userdiff and funcname.

Michael
Previous: Stefan Haller
Message 4 of 4 in “Interdiff between amended commits”
  1. Stefan HallerApr 13, 2011
  2. Michael J GruberApr 14, 2011
  3. Stefan HallerApr 14, 2011
  4. Michael J GruberApr 14, 2011

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.