When I do
git diff COMMIT I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit.
I haven’t found any obvious options on
log that will give me that output.
To see the diff for a particular
COMMIT hash, where
COMMIT is the hash of the commit:
git diff COMMIT~ COMMIT will show you the difference between that
COMMIT‘s ancestor and the
COMMIT. See the man pages for git diff for details about the command and gitrevisions about the
~ notation and its friends.
git show COMMIT will do something very similar. (The commit’s data, including its diff – but not for merge commits.) See the git show manpage.
git diff COMMIT will show you the difference between that
COMMIT and the head.)
git diff COMMIT^!
git diff-tree -p COMMIT
With git show, you would need (in order to focus on diff alone) to do:
git show --color --pretty=format:%b COMMIT
COMMIT parameter is a commit-ish:
A commit object or an object that can be recursively dereferenced to a commit object. The following are all commit-ishes: a commit object, a tag object that points to a commit object, a tag object that points to a tag object that points to a commit object, etc.