The .agignore File
.agignore uses the same syntax as .gitignore and is exclusive to ag. Place it in any directory to control what ag skips when searching that directory and its children.
Common Use Cases
Ignore large asset directories without changing .gitignore:
# .agignore
/public/assets/
/storage/uploads/
*.min.js
*.min.css
*.bundle.js
Ignore generated files:
# .agignore
*.lock
*.snap
coverage/
.pytest_cache/
__pycache__/
*.pyc
migrations/
Global agignore
Place a .agignore in your home directory (~/.agignore) to apply globally to all ag searches:
cat ~/.agignore
# *.lock
# coverage/
# node_modules/
Syntax Rules
.agignore uses gitignore syntax:
- Lines starting with
#are comments - Leading
/anchors to the current directory - Trailing
/matches directories only *matches anything except/**matches across directories
# Ignore all .log files
*.log
# Ignore the logs directory only at root level
/logs/
# Ignore all vendor directories anywhere
**/vendor/