How to diff a commit?

git, git-diff

Solution

`git diff` defaults to comparing against the working tree and/or index. The command that's built to compare trees straight out of the repo is `git diff-tree`. Try:

git diff-tree --ext-diff -p 280c5af

Problem

Let's say if I do a `git log` and see one commit with ID `280c5af57b02c41edbf947a0eed31c72e2839123` It seems that to see what changes are made in that commit, I can either do ``` git diff 280c5af57^ 280c5af57 ``` or ``` git show 280c5af57 ``` However, since I already set up `opendiff` as the diff tool (using the instruction on https://gist.github.com/bkeating/329690), the first command above will show it using `opendiff`, while the second command will use the diff on the command line. Instead of using a Bash alias or function, is there a way to tell `git` to diff it without typing or pasting in the commit ID twice? (like `svn diff -c 321234`)

Original source