Git: How to compare file from working directory with same file in earlier commit?

Viewed 140

Is there a way to compare the current state of a file (in working directory) with what the file looked like when it was commited (eg. five commits ago)?

1 Answers

Do a git log, then copy SHA id of the commit. Then run git diff command with this id, for example:

git diff (sha-id) filename
Related