[英]Restore files in a git reset --hard HEAD repository
这种情况:
git init
git remote add origin ..
git add *.*
git commit -m 'Init'
git add -all
并尝试还原“ Init”提交
git reset --hard HEAD
并重做提交
git commit -m 'Init'
结果:
nothing to commit (working directory clean)
和目录丢失:(
需要还原源文件
试过这个:
git reset HEAD@{0}
请帮助
最后,我使用git fsck --cache --no-reflogs --lost-found --unreachable HEAD
来定位文件,在这种情况下,我需要所有文件。
并用git show 'each_line_of_gitfsck' > file
保存每个文件。
没有每个人的路径,但是拥有结构的备份。
非常感谢David帮助我解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.