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? :(((
A reset will revert the current staging index and working directory back to the HEAD commit. This will undo a git rm . git checkout . A checkout will have the same effect and restore the latest version of a file from HEAD .
“git rm” command : the command to be executed on all branches, revisions and commits matching in the history, in this case it will remove the file from the repository and ignore files that don't match.
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 --
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With