Git - undoing git rm [duplicate]

2019-01-30 17:08发布

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? :(((

标签: git git-rm
1条回答
等我变得足够好
2楼-- · 2019-01-30 17:48

If you already commited changes, then:

git reset (--hard) HEAD~1

If not then:

git reset
git checkout -- $(git ls-files -d)
查看更多
登录 后发表回答