tags:

views:

74

answers:

1

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
Yes, this was what I was after. I nearly had it but my syntax was wrong. Thank you!
colinramsay
Note that `path/to/file` is full path from the top of project (top dir of repository).
Jakub Narębski