“Git Clean -fdx”恢复...可能? [英] "Git Clean -fdx" recovery... possible?

查看:327
本文介绍了“Git Clean -fdx”恢复...可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能犯了一个巨大的错误。

I probably did a huge mistake.

相关系统信息:


  • Windows XP SP2

  • i686 Cygwin 1.7.6 git

  • 1.7.1

我试图在新创建的git仓库上创建一个空分支,这里是我刚刚发布的命令:

I was trying to create an empty branch on a newly created git repository, here are the commands I just issued:

git init
git symbolic-ref HEAD refs/heads/klist 
rm .git/index   <---- this command failed obviously, there was no index. 
git clean -fdx  <---- this is my nightmare

不知道clean命令真正删除当前文件夹中的文件,并且因为这是一个新初始化的git存储库,没有旧版本还原到。

problem is I was not aware the clean command really deletes the files that are in the current folder, and as this was a newly initialized git repository there is no old version to revert to.

一些文件,我有他们上传在我的主页,但有些不是。
任何关于如何恢复文件的想法将不胜感激。我不介意使用任何种类的恢复软件,我知道,丢失linux / cygwin上的文件是一个痛苦,如果不是不可能恢复,但他可以给它一个镜头。

Some of the files I have them uploaded on my home page but some are not. Any ideas on how to recover the files will be appreciated. I dont mind using any kind of recovery software, and I am aware that losing files on linux/cygwin is a pain if not impossible to recover, but hey lets give it a shot.

推荐答案

git clean 删除未跟踪的内容,根据定义,存储库什么也不知道。这就是为什么它默认情况下不做任何事情,要求 -f 选项做任何事情 - 它本质上相似的 rm 。你现在几乎陷入绝望的恢复领域,就好像你不小心做了 rm -rf * 。如果你幸运,文件可能仍然在磁盘上。 Google搜索恢复已删除的文件,或者请求超级用户。

git clean removes untracked content, which by definition is something the repository knows nothing about. That's why it by default does nothing, requiring the -f option to do anything - it's essentially likecalling rm on everything untracked. You're pretty much stuck in desperate recovery territory at that point - as if you'd done rm -rf * yourself by accident. The files may still be on the disk, if you're lucky. Google around for "recover deleted files", or perhaps ask on superuser.

这篇关于“Git Clean -fdx”恢复...可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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