untrack files in git code example

Example 1: git ignore still tracking

git rm --cached <file>

git rm -r --cached <folder>

Example 2: git untrack file

git rm --cached filename

Example 3: github untrack files

git rm -r --cached .

Example 4: apply gitignore after commit

git rm --cached $file

Example 5: git untrack

git rm -r --cached <file>

Example 6: remove gitignore files

git ls-files --ignored --exclude-standard -z | xargs -0 git rm --cached
git commit -am "Remove ignored files"


// answer from: thSoft