You can do the following:
git show HEAD:foo.txt
In general, this syntax is very useful for viewing a file from a specific commit without touching your working tree. For example, if you want to see what was README.txt in grand-parent commit f414f31 , you can do:
git show f414f31^^:README.txt
Update: like VonC below, it is important to note here that the path here should be the full path from the root of the working tree, even if you are currently in a subdirectory.
However, when changes in the development stage are usually most often interested in differences, which means Abisern interpreted your question as a question . Simple thinking about these commands:
git diff means "what changes have not been made yet?"git diff --cached means "what changes have I already made?"
Mark longair
source share