Mac OS X restore files deleted by git rm

2019-08-28 00:08发布

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

标签: git restore rm
2条回答
Deceive 欺骗
2楼-- · 2019-08-28 00:43
git reset HEAD

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

git reset --hard HEAD
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-08-28 00:49

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
查看更多
登录 后发表回答