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

generating combined diff without an existing merge commit

From
Jacob Keller <jacob.keller@gmail.com>
Date
Oct 21, 2016, 21:40 UTC
Message-ID
<CA+P7+xrN-_zP40uAUGtqZW+OO4D4Z65SiPRykdKvauO1zgNNcQ@mail.gmail.com>
Hi,

I recently determined that I can produce an interdiff for a series that handles rebasing nicely and shows the conflicts resolved when rebasing plus any other changes.

The basic idea is something like the following, assuming that v1 is a tag that points to the first version, v2 is a tag that points to the rebased new version, and base is a tag that points to the new base of the series (ie: the upstream if the v2 is on a branch and has been fully rebased)

git checkout v1 git merge base #perform any further edits to get everything looking like v2 git commit git show -cc HEAD

This is also equivalent to the following without having to actually do the merge manually:

git commit-tree v2^{head} -p v1 -p master -m "some merge message" git show <output from the commit tree above)

this nicely shows us the combined diff format which correctly shows any conflicts required to fix up during the rebase (which we already did because we have v2) and it also shows any *other* changes caused by v2 but without showing changes which we didn't actually make. (I think?)

The result is that we can nicely see what was required to produce v2 from v1 but without being cluttered by what changed in base.

However, I have to actually generate the commit to do this. I am wondering if it is possible today to actually just do something like:

git diff <treeish> <treeish> <treeish> and get the result that I want?

I've already started digging to see if I can do that but haven't found anything yet.

Thanks, Jake

Next: Jacob Keller
Message 1 of 8 in “generating combined diff without an existing merge commit”
  1. Jacob KellerOct 21, 2016
  2. Jacob KellerOct 21, 2016
  3. Junio C HamanoOct 21, 2016
  4. Jacob KellerOct 21, 2016
  5. Documentation/git-diff: document git diff with 3+ commitsMichael J Gruber, Oct 26, 2016
  6. Junio C HamanoOct 26, 2016
  7. Michael J GruberOct 27, 2016
  8. Junio C HamanoOct 27, 2016

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.