If you are not familiar with Git, check out our getting started article. These examples are based on Linux. Let's say you've added and commited example.txt in Git, and example.txt contains the following.
Then you replaced Foo with Bar, and commited example.txt.
The git log will show both commits.
afba75a second commit 741785c first commit
The git show command can be used to view the content of the file at a specific commit. The syntax of git show is:
git show <commit id>:<path to file>
The git show command can be used to determine the appropriate path to the file.
git show <commit id> --name-only
Which will return a result such as:
In this example, the state of the file in first commit will be displayed.
git show 741785c:misc/example.txt
Which will have Foo, in this example.
In this example, the state of the file in second commit will be displayed.
git show afba75a:misc/example.txt
Which will have Bar, in this example.