An ignore file filters untracked paths when Git decides what to show and add. It does not remove a secret or generated file already committed. Write a narrow pattern that matches the requested temporary output without excluding source files. Then stage the rule and inspect what remains untracked. The fixtures include a similarly named retained file so a broad wildcard is visibly wrong. Removing an existing tracked file requires an index operation as a separate step. For example, *.tmp retains route.txt while excluding cache.tmp. A broad star also excludes future source files. Inspect the pattern and the index independently, because an ignored path may already exist in committed history.