git log -p shows the commit hash, author, date, and diff for the specified file, and accepts a filename. The
-p flag shows the diff between each revision and its parent:
git log -p -- filename.txt
commit f1bce3642c0o2e6c5d10beb5e166x54bf9703f3f Author: Nashu Kanagiri <email@example.com> Date: Fri Dec 6 20:56:19 2019 +0000 important changes to this file diff --git a/resources/square.ts b/resources/square.ts ...
If you'd like to view the file as it was at a certain point in time, pass the commit hash to the
git show command, along with the filename (I like to pipe the contents into vim via stdin):
git show f1bce3642c0o2e6c5d10beb5e166x54bf9703f3f:resources/square.ts | vim - -n