git remove file to .gitignore and clear cache code example Example: git rm cached gitignore git rm -r --cached .