akash88 akash88 - 8 days ago 5
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?

YSC YSC
Answer

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.

Comments