简体   繁体   English

如何恢复更改后尚未提交的本地删除文件

[英]How to recover locally deleted files that has not been committed after changes

I have a folder that all files have been deleted. 我有一个文件夹,所有文件都已删除。 I can see all the files by doing this command : 我可以通过执行以下命令查看所有文件:

git ls-files --deleted

I've made locally changes that have not been added/committed. 我做了一些尚未添加/提交的本地更改。

How can I restore all the files with my last modifications ? 如何使用上次修改恢复所有文件?

Thanks ! 谢谢 !

If you run git status you will be given some information about the current state and what you could do. 如果您运行git status您将获得有关当前状态以及您可以执行的操作的一些信息。

You may recover a locally deleted file, to a state known to git, with: 您可以将本地删除的文件恢复到git已知的状态,其中:

git checkout -- <file>

Any changes made to the file is lost if you have not staged it ( git add <file> ) before you deleted it. 如果您在删除git add <file>之前没有进行任何更改( git add <file> ),则对文件所做的任何更改都将丢失。

Some IDE:s keeps a local history of files changed by the IDE, maybe you could find your changes there after you restored them from git. 某些IDE:s保留了由IDE更改的文件的本地历史记录,也许您可​​以在从git恢复后找到更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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