Git - 撤消git rm [英] Git - undoing git rm

查看:133
本文介绍了Git - 撤消git rm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

如何恢复git rm -r?


Git SOS在这里。我在没有提交的项目上工作了10个小时(我知道,我知道),然后我git添加了太多文件,所以我尝试使用git rm并意外删除了所有内容。我有希望吗?如果你已经提交了更改,那么:



解决方案

pre> git reset(--hard)HEAD〜1

如果没有的话:

  git reset 
git checkout - $(git ls-files -d)


Possible Duplicate:
How to revert a "git rm -r ."?

Git SOS here. I worked 10 hours on a project without committing (I know, I know) and then I git added too many files, so I tried using git rm and accidentally deleted EVERYTHING. Is there hope for me? :(((

解决方案

If you already commited changes, then:

git reset (--hard) HEAD~1

If not then:

git reset
git checkout -- $(git ls-files -d)

这篇关于Git - 撤消git rm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆