Skip to content

Filtering and Ignore Rules

Renamify provides powerful filtering options to control exactly which files get processed during renaming operations.

By default, Renamify respects standard ignore mechanisms:

  • .gitignore files at all levels
  • .git/info/exclude (repository-specific ignores)
  • Global git ignore rules (~/.gitignore_global, etc.)
  • .rgignore files (ripgrep-specific ignore files)
  • Hidden files and directories are skipped (starting with .)

This means Renamify won’t process files in node_modules/, target/, .git/, etc. by default.

Use ripgrep-style unrestricted flags to reduce filtering:

Disables .gitignore files but respects other ignore mechanisms:

Terminal window
renamify plan old_name new_name -u
  • ✅ Processes files ignored by .gitignore
  • ❌ Still respects .git/info/exclude and global git ignore
  • ❌ Still skips hidden files
  • ❌ Still skips binary files

Disables all ignore files and shows hidden files:

Terminal window
renamify plan old_name new_name -uu
  • ✅ Processes all ignore files
  • ✅ Shows hidden files and directories
  • ❌ Still skips binary files

Processes everything, including binary files:

Terminal window
renamify plan old_name new_name -uuu
  • ✅ Processes all files
  • ✅ Shows hidden files and directories
  • ✅ Treats binary files as text (dangerous!)

⚠️ Warning: Level 3 can corrupt binary files. Use with extreme caution.

Use glob patterns to specify exactly which files to process:

Terminal window
# Only process Rust source files
renamify plan old_name new_name --include "**/*.rs"
# Only process files in src/ directory
renamify plan old_name new_name --include "src/**"
Terminal window
# Process Rust and TypeScript files
renamify plan old_name new_name --include "**/*.rs,**/*.ts,**/*.tsx"
# Process specific directories
renamify plan old_name new_name --include "src/**,lib/**,tests/**"

Skip specific files or directories:

Terminal window
# Exclude test files
renamify plan old_name new_name --exclude "**/*test*"
# Exclude build outputs and dependencies
renamify plan old_name new_name --exclude "target/**,node_modules/**,dist/**"
# Exclude specific file types
renamify plan old_name new_name --exclude "**/*.min.js,**/*.bundle.js"
Terminal window
# Process TypeScript files but skip tests and node_modules
renamify plan old_name new_name \
--include "**/*.ts,**/*.tsx" \
--exclude "**/*test*,node_modules/**"

Use --exclude-match to skip specific compound words or identifiers that match your pattern but shouldn’t be changed:

Terminal window
# Skip specific compound words that contain your pattern
renamify plan foo bar --exclude-match bazFooQux,FooService
# Useful when a pattern accidentally matches unintended identifiers
renamify rename config settings --exclude-match ConfigurationManager

This is particularly useful when:

  • Your pattern matches part of a larger compound word
  • Certain identifiers contain your pattern but have different meanings
  • You want to be very selective about what gets changed

Use --exclude-matching-lines to filter out matches on lines that match a regex pattern. This is perfect for skipping comments, TODO markers, or any other line-level patterns:

Terminal window
# Skip C-style comment lines (starting with //)
renamify plan old_name new_name --exclude-matching-lines '^//'
# Skip Python/Shell comment lines (starting with #)
renamify plan old_name new_name --exclude-matching-lines '^\s*#'
# Skip both // and /* style comments
renamify plan old_name new_name --exclude-matching-lines '^\s*(//|/\*)'
Terminal window
# Skip lines containing TODO or FIXME
renamify plan old_name new_name --exclude-matching-lines '(TODO|FIXME)'
# Skip lines with any common code markers
renamify plan old_name new_name --exclude-matching-lines '(TODO|FIXME|HACK|NOTE|XXX)'
Terminal window
# Skip lines containing DEBUG
renamify plan old_name new_name --exclude-matching-lines 'DEBUG'
# Skip console.log statements
renamify plan old_name new_name --exclude-matching-lines 'console\.(log|debug|error)'
# Skip test assertions
renamify plan old_name new_name --exclude-matching-lines '(assert|expect|test|describe)\('
Terminal window
# Skip Python linter directives
renamify plan old_name new_name --exclude-matching-lines '#.*(pylint|type:|noqa)'
# Skip JSDoc comments
renamify plan old_name new_name --exclude-matching-lines '^\s*\*'
# Skip lines with specific annotations
renamify plan old_name new_name --exclude-matching-lines '@(deprecated|internal|ignore)'
  • The regex matches against the entire line containing the match
  • Use ^ to match from the start of the line
  • The pattern is case-sensitive by default
  • Invalid regex patterns will cause an error before scanning begins

This feature is particularly useful when:

  • You want to preserve comments that reference old names
  • You have TODO items mentioning future renames
  • You want to exclude matches in debug/logging code
  • You need to skip matches in specific code annotations

Renamify uses standard glob patterns:

PatternMatches
*Any filename (not directories)
**Any number of directories
?Single character
[abc]Any character in brackets
[!abc]Any character not in brackets
{a,b,c}Any of the comma-separated alternatives
Terminal window
# All JavaScript files recursively
"**/*.js"
# All files in src/ and lib/ directories
"{src,lib}/**"
# TypeScript files but not declaration files
"**/*.ts" --exclude "**/*.d.ts"
# Files starting with 'test' or 'spec'
"**/{test,spec}*"

Renamify automatically detects and skips binary files by default:

  • File extension: .jpg, .png, .exe, etc.
  • Content analysis: Checks for null bytes and non-UTF8 content
  • Magic numbers: Recognizes common binary file headers
Terminal window
# Force processing of all files (dangerous!)
renamify plan old_name new_name -uuu
# Include specific binary extensions (not recommended)
renamify plan old_name new_name --include "**/*.{bin,dat}"

Renamify automatically prompts to ignore its workspace directory on first use:

Renamify uses .renamify/ for plans, backups, and history.
Ignore it now?
[Y] Repo .gitignore [l] Local .git/info/exclude [g] Global excludesfile [n] No
Choice (Y/l/g/n):
Terminal window
# Automatically add to .gitignore without prompting
renamify --auto-init=repo plan old new
# Prevent any auto-initialization
renamify --no-auto-init plan old new
# Use -y for non-interactive environments (CI)
renamify -y plan old new
Terminal window
# Be specific with includes to avoid scanning unnecessary files
renamify plan old new --include "src/**/*.{js,ts,tsx}"
# Exclude large directories early
renamify plan old new --exclude "node_modules/**,target/**,.git/**"

Renamify automatically uses parallel directory traversal and file processing for optimal performance on large codebases.

Terminal window
# React/TypeScript project
renamify rename oldName newName \
--include "src/**/*.{ts,tsx,js,jsx}" \
--exclude "**/*.test.*,**/__tests__/**,node_modules/**"
Terminal window
# Rust project with tests
renamify rename old_name new_name \
--include "**/*.rs" \
--exclude "target/**"
Terminal window
# Python with tests in separate directory
renamify rename old_name new_name \
--include "**/*.py" \
--exclude "venv/**,__pycache__/**,*.pyc"
Terminal window
# Only process markdown and text files
renamify rename old_name new_name \
--include "**/*.{md,txt,rst}"