akash88 akash88 - 1 year ago 185
Git Question

How to undo git rm . -r --cached command without losing any uncommitted changes?

I've accidentally executed a

git rm . -r --cached
command which makes all files have deleted status. I have some uncommitted changes which I do not want to lose. How can I undo the effects of
git rm . -r --cached
command and return to the previous state without losing any uncommitted changes?

Answer Source

Since you used the --cached option, only your index has been modified. Your working directory has been left as is. You can simply git add files marked as deleted.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download