Git - undoing git rm

GitGit Rm

Git Problem Overview


> 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 Solutions


Solution 1 - Git

If you already commited changes, then:

git reset (--hard) HEAD~1

If not then:

git reset
git ls-files -d -z | xargs -0 git checkout --

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1436111View Question on Stackoverflow
Solution 1 - GitHaulethView Answer on Stackoverflow