I accidentally added a local directory to my local Git repo.
git add dirName
It added the twenty or so files in that directory. I did not want them added. They had never been added before, and I did not commit them. Instead, I removed them with:
git rm -rf dirName
This successfully removed them from the repo, but to my dismay that directory also appears to have been deleted from disk. They are not in my recycle bin.
Is there any way to get those files back? I have a backup, of course, but I had made quite a few changes to the files since the last backup.
no there isn’t because
is like
which is also irreversible but it also removes the staging files so there is no way you can get the files back. Next time use git rm –cached dirName which will only remove it from stage and not from your disc.