Recover deleted files from using git rm
Unknowingly, without finding out what the command does, i used the git rm -r command on a folder of a proyect thinking it would delete all files only inside that folder. To my surprise, all my files where deleted.
I found a way to recover my files from my last commit (about 3 days ago) using the following commands:
git reset
git checkout -- $(git ls-files -d)
Now my question is, all the work i have done during that last 3 days, is there ny way i can recover this? Even if its just the files so i can copy and paste. All the files deleted where atleast added to the repository, im trying to find a way to either recover my project the way it was before i did git rm -r or if i can recoverd the files individual so i can copy and past. Thank you for any help
As long as the files are added to the repo (not yet committed), there is a chance to recover them.
See "Recovering added file after doing git reset --hard HEAD^"
git fsck --cache --no-reflogs --lost-found --dangling HEAD
cd .git/lost-found/other
But the surest way remains to commit often indeed.
链接地址: http://www.djcxy.com/p/23512.html上一篇: 如何列出使用'skip'忽略的文件
下一篇: 从使用git rm恢复已删除的文件