Git: Recover a deleted file


To get a deleted file from git (whatever the reason could be), there the command:

git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"


About Saïd

Software developer.
This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.