GIT: When files are deleted in some commit in the past

Find the last commit that affected the given path. As the file isn't in the HEAD commit, this commit must have deleted it.

git rev-list -n 1 HEAD -- <file_path>  

Then checkout the version at the commit before, using the caret (^) symbol:

git checkout <deleting_commit>^ -- <file_path>  

Restore the full working tree from a distant commit

git reset --hard <revision>  
comments powered by Disqus