how to exclude a directory in gitignore that has aleady been committed code example Example: gitigore rm cache git rm -r --cached .