How can I recover files after accidentally running “git clean -df”?

二次信任 提交于 2019-12-18 08:59:24

问题


I have accidentally run git clean -df. It removed my files from my current commit, which I had yet to push. Now, in git status, those files are marked with D, which means "deleted".

Is there any way to get those files back?


回答1:


git clean only untracked files and not committed ones.

You might have done other operations if you see D as the status for already committed files.

You get back those files, do:

git checkout .

or

git reset --hard


来源:https://stackoverflow.com/questions/25722470/how-can-i-recover-files-after-accidentally-running-git-clean-df

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!