41

Possible Duplicate:
Restore a deleted file in a Git repo

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.

Community
  • 1
  • 1
Steve Emmerson
  • 7,702
  • 5
  • 33
  • 59

1 Answers1

60

git checkout <commit> <path>

Commits may be specified directly by SHA1, or via a branch or tag. Make sure that the represents the state of the repository when the deleted file was still present. If the commit argument is omitted, the currently checked out commit (HEAD) will be used.

ilya1725
  • 4,496
  • 7
  • 43
  • 68
wulfovitch
  • 3,216
  • 2
  • 24
  • 15