git恢复删除的文件

如果在当前工作区删除了文件,又想恢复回来,可以这样:

$ git checkout -- filename

如果删除了一批文件想恢复回来,可以这样:

$ git ls-files --deleted | xargs git checkout --

其中git ls-files –deleted是列出所有被删除的文件。

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.