Git Recovering Restore a deleted file after a commit


Example

In case you have accidentally commited a delete on a file and later realized that you need it back.

First find the commit id of the commit that deleted your file.

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

Will give you a sorted summary of commits which deleted files.

Then proceed to restore the file by

git checkout 81eeccf~1 <your-lost-file-name>

(Replace 81eeccf with your own commit id)