How to see the changes in a Git commit?


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 diff / log that will give me that output.

4/8/2019 4:29:06 AM

Accepted Answer

To see the diff for a particular COMMIT hash:

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.

Alternatively, 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.

6/28/2018 3:45:25 PM

As mentioned in "Shorthand for diff of git commit with its parent?", you can also use git diff with:

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

The 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.

See gitrevision "SPECIFYING REVISIONS" to reference a commit-ish.
See also "What does tree-ish mean in Git?".


You can also try this easy way:

git show <COMMIT>

git show shows the changes made in the most recent commit.

Equivalent to git show HEAD.

git show HEAD~1 takes you back 1 commit.


I usually do:

git diff HEAD~1

To show the changes regarding the last commit. If you have more commits just increase the number 1 to how many commits diff you want to see.


First get the commit ID using,

git log #to list all


git log -p -1 #last one commit id

Copy commit id.

Now we use two methods to list changes from a specific commit,

Method 1:

git diff commit_id^! #commit id something like this 1c6a6000asad012

Method 2:

git show commit_id
For example: git show 1c6a600a