Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diff between commit deltas, not commits themselves

Tags:

git

diff

delta

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!

like image 632
Nick Crews Avatar asked Dec 21 '18 01:12

Nick Crews


1 Answers

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.

like image 191
Nick Crews Avatar answered Sep 28 '22 02:09

Nick Crews