I've deleted a file with Git and then committed, so the file is no longer in my working copy. I want to look at the contents of that file, but not actually restore it. How can I do this?
+8
A:
git show HEAD^:path/to/file
You can use an explicit commit identifier or HEAD~n
to see older versions or if there has been more than one commit since you deleted it.
Charles Bailey
2009-09-08 18:15:52
Yes, this was what I was after. I nearly had it but my syntax was wrong. Thank you!
colinramsay
2009-09-08 18:22:22
Note that `path/to/file` is full path from the top of project (top dir of repository).
Jakub Narębski
2009-09-08 21:47:06