gitignore committed file code example Example 1: apply gitignore after commit git rm --cached $file Example 2: git ignore after commit git rm --cached /\*.exe