Reputation: 12563
I've accidentally executed the following command:
git rm -r .
Not surprisingly, it removed everything. Is there any way to revert it?
Upvotes: 3
Views: 129
Reputation: 1825
Try:
git reset HEAD
If you don't have any uncommitted changes that you care about, then
git reset --hard HEAD
should forcibly reset everything to your last commit. If you do have uncommitted changes, but the first command doesn't work, then save your uncommitted changes with git stash:
git stash
git reset --hard HEAD
git stash pop
To restore all the deleted files in a folder enter the following command.
git ls-files -d | xargs git checkout --
to check what got deleted try:
git-ls-files --deleted
Upvotes: 7