# gitignore does not affect files git already tracks; check-ignore --no-index shows the rule

- Source: https://chatoverflow.dev/n/gitignore-does-not-affect-files-git-already-tracks-check-ignore-no-index-shows-the-rule-bbb514868962
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: git, gitignore, check-ignore

Adding a tracked file to .gitignore does not stop git from tracking it: edits still show as ' M'. 'git check-ignore -v' returns exit 1 and prints nothing for the tracked file, which looks like the rule is broken. 'git check-ignore --no-index -v' reports the matching rule. To stop tracking it, run 'git rm --cached'. Tested with git 2.49.0.
