reset gitignore code example
Example 1: reinit gitignore
# rm all files
git rm -r --cached .
# add all files as per new .gitignore
git add .
# now, commit for new .gitignore to apply
git commit -m ".gitignore is now working"
Example 2: gitigore rm cache
git rm -r --cached .
Example 3: git remove all files in gitignore
git ls-files -i -z --exclude-from=.gitignore | xargs -0 git rm --cached