| title | Accidental __pycache__ artifacts committed to a data repository | ||||
|---|---|---|---|---|---|
| domain | development | ||||
| tags |
|
||||
| status | published | ||||
| evidence_level | E2 | ||||
| created | 2026-08-11 00:00:00 UTC | ||||
| updated | 2026-08-11 00:00:00 UTC |
A pull request intended to change CSV data rows also shipped __pycache__/csv_to_json.cpython-314.pyc (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed.
The contributor used git add -A inside a worktree that contained Python __pycache__ directories generated by an earlier local run of a validation script. There was no .gitignore, so bytecode files were staged alongside the intended changes.
Remove the staged artifacts and prevent recurrence with a .gitignore.
Remove the artifacts from the index and disk:
git rm --cached -r __pycache__ 2>/dev/null || true
git rm -r --cached '*.pyc' 2>/dev/null || true
rm -rf __pycache__Add a .gitignore covering Python bytecode:
__pycache__/
*.pyc
Re-stage only the intended files instead of the whole directory:
git add references/offers/sdks.csv
git commit -m "fix: remove committed pycache artifacts"Verify the diff contains only intended changes: git status --short and git diff --name-only should list nothing under __pycache__.
git ls-files | grep -c pycreturns 0.git status --shortshows only intended files.- CI passes on the cleaned branch.
Never git add -A in worktrees where scripts generated artifact directories. A .gitignore with __pycache__/ and *.pyc is the cheapest insurance against reviewer-triggering noise, and stage specific files rather than whole directories.