I searched the internet on how to removed already deleted files from a GIT repository. That is because I get annoyed of having so many deleted files that I need to delete one by one. I can manage to delete them if say 5 to 20 files. However, today I’m messing up with bunch of files from different directories with no filename pattern.
To remove a file from a GIT repository, you simply:
git rm path/file/name
That way, the file is deleted from disk and from the repo.
However, if you want to delete multiple files (maybe you don’t want them anymore) you simply open your favorite file browser / file manager and delete them using mouse perhaps. They are deleted from the disk, but you also need to delete them from the repository.
The command above will show the repository status and will show messages that you have deleted files but are not committed. To delete that, I found this site:
The suggested bash script works but it is ugly and hard to remember. So reading the comments, here is the best way I think.
git rm $(git ls-files -d)