Search code examples
gitgit-diff

Git - easiest way to see diff with previous version if I have the sha


A colleague of mine checked in some changes to Git, and I want to see exactly what those changes were. In other words, the diff between his check-in and its parent.

What seemed logical to me was to run this command:

git diff shaOfHisCheckIn

But this didn't work. It appears to show the diff between that SHA and my current working copy.

What's the correct command to show the diff between a given SHA and its parent?


Solution

  • git show is your friend:

    git show shaOfHisCheckIn