Git still showing deleted files after a commit
How can I remove deleted files from my Git repo?
I've deleted a folder of a JavaScript library, which contained many files. I then went to commit the changes like so:
git add .
git commit "message"
git status
But it shows all those files as "deleted ....".
How can I make them go away?
This will add deletes as well.
git add -u .
Check what's staged to be committed with:
git status
If it lists the files under the "to be committed" section, then just proceed with the commit; the files will remain deleted. (Git tracks deletions too, not just changes.)
If it lists the files under the "changed but not updated" section, then you have two options:
- Undelete them by restoring the version in the index:
git checkout path/to/folder
- Mark them deleted in Git, then commit:
git rm -r path/to/folder