6

I have two branches coming from commit a:

a - b - c \ d - e

What I want to see is a diff between the changes introduced in c and e. I can easily view the differences between e and c themselves, but that's not what I want, because that diff includes changes introduced in b and d, and those two commits are different from each other. Abstractly I guess what I want would be something like

diff(diff(b, c), diff(d, e))

Is there a good way to do this? The edits introduced in c and e are only different by maybe 50 lines, so it's not that many, the problem is that this 50 line signal is getting lost in the ~1000 line noise from the difference between b and d. Thanks for the help!

Nick Crews
  • 608
  • 7
  • 11
  • Are c and e very similar but different a bit? Or c and e are completely not related? – shirakia Dec 21 '18 at 01:30
  • 3
    There is a program that diffs diffs, called "interdiff". It is not part of Git, but you can install it and see if it does what you want. – torek Dec 21 '18 at 01:38

1 Answers1

5

Thanks for the comments, the interdiff lead was enough to help me find the answered question How do I get the interdiff between these two git commits?.

The simple answer (https://stackoverflow.com/a/17793943/5156887) was to use
diff <(git log -p -1 c) <(git log -p -1 e)

and the better answer (https://stackoverflow.com/a/52278675/5156887 ) if you have git 2.19 is the builtin git range-diff. I didn't have that new of a version so I couldn't find it.

Nick Crews
  • 608
  • 7
  • 11
  • 2
    This is the best self-answer I've seen in a long time. Well researched and informative. Also, excellent job balancing out the links to other answers against summarizing the content of the links. – Mad Physicist Dec 21 '18 at 02:00
  • I had forgotten about the new range-diff feature. Note that it's substantially more complex than a simple interdiff, though. – torek Dec 21 '18 at 05:23
  • Why does the "simple" version don't use `git show`, i.e. something like `diff – doak Dec 21 '18 at 11:39