.gitignore was delete code example Example: git remove all files in gitignore git ls-files -i -z --exclude-from=.gitignore | xargs -0 git rm --cached