I work with git fairly regularly for my day job. I was in need of removing a directory that the CMS uses for caching objects for which there was no need to version control. I discovered that the best way to accomplish the task is the following command:
The -r
command removes the directory in question. Specifying --cached
ensure that you don't remove your working copy. Instead it removes the directory from git's index. Without that flag set, git would flat out remove the directory/file from the system entirely.