add a file already in git to gitignore code example Example 1: git untrack file git rm --cached filename Example 2: git ignore after commit git rm --cached /\*.exe