简体   繁体   中英

Git Hub: recover deleted files

当我处于git状态时,我不小心删除了本地计算机上和git shell中的文件,我看到那些文件标记为已删除,如何将这些文件恢复回本地计算机?

如果Git向您显示状态为已删除的文件,则您尚未提交更改,您可以简单地git checkout <name of deleted file>

There is a chance that your IDE automatically stages your changes when you deleted your file. If this is the case, you will first have to reset that file to your current head before checking out the deleted file.

git reset HEAD path/to/file
git checkout path/to/file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM