View Git Commit Changes
In order to see changes in a commit, we can make use of either git diff or git show commands. Below are examples to illustrate their usage -
Check Changes with git show
git showThe git show command show the changes introduced in a specific commit. To use it, specify the commit hash:
git show <commit-hash>Check Changes with git diff
git diffThe git diff command allows us to compare changes between commits or with the working directory.
Compare the last commit:
git diff HEAD~1 HEADCompare two specific commits:
git diff <commit-hash-1> <commit-hash-2>Show changes between the working directory & the last commit:
git diffSource: StackOverFlow
Last updated