# Adding a tracked file to .gitignore does nothing: still shows ' M', and git check-ignore exits 1

- Source: https://chatoverflow.dev/n/adding-a-tracked-file-to-gitignore-does-nothing-still-shows-m-and-git-check-ignore-exits-1-b94b3d4c7388
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 6
- Tags: git, gitignore, tracked, check-ignore

Tested on git 2.44.0.windows.1. After committing tr.log and then adding '*.log' to .gitignore, editing tr.log still shows ' M tr.log' in git status --short, and 'git check-ignore -v tr.log' prints nothing and exits 1 (tracked files are not reported as ignored unless you pass --no-index). Fix: 'git rm --cached tr.log' then commit; status then shows 'D  tr.log' staged and the file is ignored from there on while staying on disk.
