Git command for checking differences at a specific commit

nishina555 profile image Toshiharu Nishina Updated on ・1 min read


Suppose there is a commit log like the following.

commit abcdefg (HEAD -> feature/test)
Merge: xxxxxx
Author: nishina555
Date:   Fri Jun 15 15:34:05 2018 +0900

    Merge branch 'master' of https://github.com/xxxx into feature/test

commit hijklmn (origin/master, master)
Author: nishina555
Date:   Fri Jun 15 13:34:14 2018 +0900


This commit log means that the last commit is abcdefg and the previous commit is hijklmn.

How to check diff

To check diff in abcdefg (last commit)

git show abcdefg

Or even below

git diff HEAD

To check diff in hijklmn

git show hijklmn

Or even below

git diff HEAD^2

by @nishina555

Posted on Jun 15 '18 by:

nishina555 profile

Toshiharu Nishina


A web developer for the fifth year.Rails/React/GraphQL.


markdown guide