Here’s a great Git tip if you want to view an older version of a file on a certain branch / commit. As with other things with Git, there’s more than one way to cook an egg.
#1 git diff
cd to your working tree directory and find the commit ID (SHA-1) by listing commits with
git diff <commit-SHA1> <relative_path_file>
git diff e8581zt /api/main.go
git diff shows the differences between the specified commit and whatever our HEAD points to at the moment.
#2 git show
git diff, use:
git show <commit-SHA1> <relative_path_file>
git show e8581zt /api/main.go
git show points the details shown with
git diff as well as the commit details: commit ID, author, date and message.