How To Compare Git Commits from Last Commit

This quick overview will cover how to compare changes between commits or any commit in git log history.

Compare from the last commit:

git diff HEAD^ HEAD

Or alternatively, use commit IDs

git diff 0594b24 3851af3 

Or using alias

git diff @^ @

Comparison by default compares to the HEAD you can further rewrite to

git diff HEAD^
git diff 0594b24
git diff @^

or simply use which compares to the last commit.

git show

Leave a Reply

Your email address will not be published. Required fields are marked *