Restore the deleted files with GIT

Posted on February 19, 2009, under GIT.

Today, it was a shock, that I have deleted few files without my knowledge. Fortunately, before deleting I had committed the files and so no much of tension. You can use the following commands to restore it.

View the list of deleted files:

1
git ls-files -d

This will list the deleted file and lets restore it now.

1
git ls-files -d | xargs git checkout --

Hope this helps somebody.

Cheers!

Leave a Comment

You must be logged in to post a comment.