Git结帐 - 恢复丢失的文件 [英] Git checkout -- recover lost files
问题描述
我意外删除了git存储库上的本地文件更改。他们没有被提交,甚至没有推送。
我做了什么:
git status
提交显示,我意外地通过这个命令删除了整个文件夹smdr):
git checkout - smdr
如何恢复这些文件(在git checkout-smdr命令之前返回所有内容)?
你无法使用Git。这些文件没有提交,因此它们不在历史中。你只是在索引中获得了 git checkout
。
你唯一的希望就是你的备份系统。
I accidentaly deleted local file changes on git repository. They were NOT commited or even pushed.
What I did: git status (then files not staged for commit showed and I accidentaly removed whole folder called "smdr" by this comand): git checkout -- smdr
Then files changes disappeared.
How can I recover those files (birng everything back before that git checkout -- smdr comand)?
You can't with Git. The files were not committed so they are not in history. You just got the (inexistant) version in the index with git checkout
.
Your only hope is your backup system.
这篇关于Git结帐 - 恢复丢失的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!