How To Recover a Deleted File From Your Git Repository

First if you’re not sure of the name of the deleted file check through your Git log ..

git log --diff-filter=D --summary

Find the last commit that affected the given file

git rev-list -n 1 HEAD -- ./path/to/file/

.. I’ll refer to that as REVISON_NUMBER

Now we can checkout the previous revision

git checkout REVISON_NUMBER^ -- ./path/to/file/