I’ve been using a simple home grown script (gitdiffc) to generate git diffs against the previous version for all files in a given commit. It would run something like:
The git log part, just gives two commit IDs. Example:
I have a few files that I have to manually merge, as there are two many cherry-pick conflicts, so I was collecting information for that merge. That included extracting the version that I would have wanted to cherry-pick, since :
I also wanted a diff, of just that file, in the branch I am trying to pick from, but wasn’t sure how to get that easily without looking up the log, like I did in my ‘gitdiffc’ script that ran the log and diff command above.
I figured there had to be an easier way. Shout out to Grok, which pointed out that I can just use:
This also means that I can simplify my ‘gitdiffc’ script so that it just runs:
eliminating the nested git log command. That is simple enough that I don’t even need a script to remember how to do it. This should have been obvious, since I’ve used HEAD^ just like that so many times (i.e.: git reset HEAD^, to break up the last commit.)