You can view a list of all the deleted files using the command.
$ git ls-files --deleted
Use this this command to restore your deleted file. Replace the <deleted-file>
with the deleted filename.
$ git checkout -- <deleted-file>
If the deletion has been committed, find the commit where it happened.
$ git rev-list -n 1 HEAD -- <deleted-file>
b6e9c0b612d71a83bfae3a1afc5c252f53165896 # The commit hash
Then recover the file from this command. Replace the <commit-hash>
with the actual hash that was returned from the previous command.
$ git checkout <commit-hash> -- <deleted-file>