Git结帐 - 恢复丢失的文件 [英] Git checkout -- recover lost files

查看:145
本文介绍了Git结帐 - 恢复丢失的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意外删除了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆