Mac OS X restore files deleted by git rm

被刻印的时光 ゝ 提交于 2020-01-06 08:11:39

问题


i just messed up big. The way it happened is so emberassing that I won't write it down :)

So here's my problem:

  • Github Repop deleted
  • Local repo files delete by git rm -r
  • Local repo new initalized

Is there any chance how to restore my data? Luckily it's in a very very early stage of this project.

Regards


回答1:


git reset HEAD

If you don't have any uncommited changes you care about then use

git reset --hard HEAD



回答2:


I am not sure I completely understand the state of your local repo, but if all you did was a git rm -r * and committed that, then everything is still there. You can just reset to the previous commit:

git reset --hard HEAD~1


来源:https://stackoverflow.com/questions/12183106/mac-os-x-restore-files-deleted-by-git-rm

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