问题描述
在我的本地机器上,我从文件夹中删除了文件。
git init
git add --all
然后我写了(不要问我,为什么!:))
git rm -rf
我还没有提交。现在我的项目中有空文件夹。在 .git
文件夹中包含53 MB的文件的 objects
。
如何恢复我的文件?我尝试过Drill Disc和Stellar等程序,但没有找到我的文件。我无法从GIT回滚。
如何恢复丢失的文件?
git fsck
代替它,它是一个用于检索你曾经添加到git仓库中的文件的内置命令。 git fsck --lost-found --unreachable
命令处理后,检索到的文件将被放置在 .git / lost-found / other
中,文件名sha256散列。虽然原名仍然丢失,但内容将会恢复。
您可以在 假设有一个 可以获取丢失文件的内容。 但是我很抱歉,我不知道重建您的目录或自动执行此操作。 On my local machine I removed files from folder. then I wrote (don't ask me, why! :) ) I don't commit, yet. Now I have empty folders in my project. In How can I recover my files? I've tried programs like Drill Disc and Stellar, but not found my files. And I can't rollback from GIT. How can I recover the lost files? (update) Use after the command processing, retrieved files will be placed at You can find your files in your Suppose there is a to get the content of your lost file. But I'm sorry, I have no idea about reconstructing your directory or doing this automatically. 这篇关于在'git rm -rf'后恢复staged但未提交的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!目录。
.git / objects / 2f / ae996f8f8f9298b41ba4fdbac3d62014f9579e
对象,你可以执行
git cat-file -p 2fae996
$ b
git init
git add --all
git rm -rf
.git
folder has objects
with 53 Mb of files. git fsck
instead, it is a builtin command for retrieving files you have once added to git repository.git fsck --lost-found --unreachable
.git/lost-found/other
, with file name of a sha256 hash. Although the original name is still lost, the content will be back..git/objects
directory..git/objects/2f/ae996f8f8f9298b41ba4fdbac3d62014f9579e
object, you can executegit cat-file -p 2fae996