简体   繁体   English

Mac OS X恢复由git rm删除的文件

[英]Mac OS X restore files deleted by git rm

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 Github Repop已删除
  • Local repo files delete by git rm -r 本地回购文件由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 reset HEAD

如果您没有任何未提交的更改,请使用

git reset --hard HEAD

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. 我不确定我是否完全了解您的本地存储库的状态,但是如果您所做的只是一个git rm -r *并提交了,那么一切仍然存在。 You can just reset to the previous commit: 您可以重置为上一个提交:

git reset --hard HEAD~1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM