Undo git rm -r --cached
Solution 1:
If you've run only git rm -r --cached
, try doing a git reset HEAD .
from within your repo root.
If you did a git commit -m "msg"
after doing a git rm -r --cached
, i.e., you committed the changes, then do git reset HEAD~1
to undo your last commit.
Solution 2:
Git works based on file caching so if you removed everything from the cache you can just reverse the whole process by executing .This will add back the files that were being tracked and tell which ones have been modified since the last commit .
> git add .