在文件夹中使用`git clean`删除了它的内容 [英] Using `git clean` in a folder deleted its contents
问题描述
我尝试在文件夹中使用Git,然后使用git glean -df
,发现所有内容都消失了.
这是否意味着我丢失了文件,有什么办法可以将它们找回来?
当您运行git clean -df
时,您包括目录.您还告诉Git忽略其安全网. /p>
如果Git知道文件(例如,曾经对它们进行过add
或stash
编辑,则即使它们已经从来没有commit
ed ),那么它们应该是可恢复的.尝试运行git fsck --cache --no-reflogs --lost-found --unreachable
,然后在.git/lost-found/
中查找已删除的对象.
否则,Git无法检索它们;您将不得不依靠其他工具,例如现有备份,文件系统快照,文件同步工具或文件系统恢复工具.
I was trying to use Git in a folder then I used git glean -df
and I found everything gone.
Does that mean I lost my files and is there any way to get them back?
When you ran git clean -df
you asked Git to
Remove untracked files from the working tree
including directories. You also told Git to ignore its safety net.
If Git knows about the files (i.e. if they've ever been add
ed or stash
ed, even if they were never commit
ed) then they should be recoverable. Try running git fsck --cache --no-reflogs --lost-found --unreachable
and then looking in .git/lost-found/
for objects that you deleted.
Otherwise there is no way for Git to retrieve them; you'll have to rely on other tools like an existing backup, filesystem snapshots, file synchronization tools, or filesystem recovery tools.
这篇关于在文件夹中使用`git clean`删除了它的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!