Ignored Paths and Already Tracked Files

Ignore rules primarily affect which untracked paths are considered for ordinary addition. A tracked file stays in history when a matching rule is added.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a generated export
  2. Separate private inputs from examples
  3. Test an ignored filename before and after it becomes tracked
  4. Define a safe migration for accidentally tracked artifacts

Trace a generated export

If a report is already tracked, adding its name to an ignore file does not prevent modifications from appearing in the working tree comparison. The index and commit distinction explains its recorded status.

Separate private inputs from examples

Store a synthetic example where a local configuration file contains machine-specific values. Verify which paths are actually tracked before sharing history. See synthetic test data for an analogous boundary.[1]

Test an ignored filename before and after it becomes tracked

Suppose a build writes dist/report.bin and the ignore rules cover dist. An untracked output is ordinarily omitted by default status and addition behavior. If a prior commit already tracks that file, edits remain visible as tracked changes despite the ignore pattern. See generated files and commits.

Untracked ignored path → noise suppressed in ordinary status
Tracked path matching same rule → edits still visible
Check index membership before relying on the ignore rule

Define a safe migration for accidentally tracked artifacts

Deliberately removing a path from tracking changes the repository snapshot, even if a local file is kept. Decide whether existing consumers need it. Verify ignore behavior on newly generated paths after making the intended change.

References

  1. Scott Chacon and Ben Straub, Pro Git ↩