views:

84

answers:

2

How do I restore a file I accidentally removed from my git repository? I know this is a trivial question, but I haven't found the answer in the documentation.

+7  A: 

git checkout [rev] file

wulfovitch
I figured it was something trivially simple. I guess I interpreted the documentation as referring to complete trees rather than individual files. Thanks.
Steve Emmerson
It *does* refer to complete trees *unless* you also give a file name. :)
Bombe
A: 

Did you commit after delete? If not you can commit and checkout the file back again.

Prashanth