Quick and simple interdiffs

xjm has a great guide for doing interdiffs using two branches for the original patch and your new changes. I must admit I'm lazier than that, and have a much simpler process for doing interdiffs on patch updates. Of course this only works if you work on one patch at a time. Branches are better when you work on different things and want to keep those things around. With that, here is my simpler interdiff workflow.

$ git apply patch
(applies the patch and adds it to the staging area)

(make my modifications with some tool)

$ git diff > interdiff.txt
(this runs a diff inbetween the staging area and my working copy)

$ git add ....
(add all files I changed to the staging area too)

$ git diff --cached > new-patch-1234.patch
(will create a patch inbetween the staging area and the checkout)

That's it. I basically use the staging area as an unnamed branch if you want to look at it that way and diff inbetween that and my working copy and then inbetween that and the checkout.

I found this to be a very quick and painless workflow to get interdiffs for quick fixes and updates. If you need to track more elaborate changes or need an interdiff between works of different people, xjm's solution is the way to go.

Add new comment