97

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

Community
  • 1
  • 1
user1436111
  • 2,071
  • 7
  • 23
  • 40

1 Answers1

182

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 --
Hauleth
  • 22,086
  • 4
  • 61
  • 108