Modern QA2026Common .gitignore Mistakes — tiles
Log inJoin
51 / 57 · 17 Git & Version Control · Gitignore and Practical Tips← prev⊞ allnext →☰ Read as one page

7.3Common .gitignore Mistakes

Forgetting to Ignore Test Outputs

# Forgetting these means test results get committed
# Adding them later does not remove already-tracked files
test-results/
coverage/

Not Handling Negation Patterns

# This ignores ALL .png files, including intentional ones
*.png

# Fix: Use negation to keep specific files
*.png
!src/assets/*.png
!docs/images/*.png

Ignoring Too Much or Too Little

# Too broad: ignores all JSON files (including test data you want to commit)
*.json

# Too narrow: misses test outputs in subdirectories
test-results/*.png  # Does NOT match test-results/chromium/screenshot.png

# Fix: Use recursive patterns
test-results/**