Filtering and Ignore Rules
Renamify provides powerful filtering options to control exactly which files get processed during renaming operations.
Default Behavior (Respects .gitignore)
Section titled “Default Behavior (Respects .gitignore)”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.
Unrestricted Mode
Section titled “Unrestricted Mode”Use ripgrep-style unrestricted flags to reduce filtering:
-u
(Unrestricted Level 1)
Section titled “-u (Unrestricted Level 1)”Disables .gitignore
files but respects other ignore mechanisms:
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
-uu
(Unrestricted Level 2)
Section titled “-uu (Unrestricted Level 2)”Disables all ignore files and shows hidden files:
renamify plan old_name new_name -uu
- ✅ Processes all ignore files
- ✅ Shows hidden files and directories
- ❌ Still skips binary files
-uuu
(Unrestricted Level 3)
Section titled “-uuu (Unrestricted Level 3)”Processes everything, including binary files:
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.
Include Patterns
Section titled “Include Patterns”Use glob patterns to specify exactly which files to process:
Single Pattern
Section titled “Single Pattern”# Only process Rust source filesrenamify plan old_name new_name --include "**/*.rs"
# Only process files in src/ directoryrenamify plan old_name new_name --include "src/**"
Multiple Patterns
Section titled “Multiple Patterns”# Process Rust and TypeScript filesrenamify plan old_name new_name --include "**/*.rs,**/*.ts,**/*.tsx"
# Process specific directoriesrenamify plan old_name new_name --include "src/**,lib/**,tests/**"
Exclude Patterns
Section titled “Exclude Patterns”Skip specific files or directories:
Common Exclusions
Section titled “Common Exclusions”# Exclude test filesrenamify plan old_name new_name --exclude "**/*test*"
# Exclude build outputs and dependenciesrenamify plan old_name new_name --exclude "target/**,node_modules/**,dist/**"
# Exclude specific file typesrenamify plan old_name new_name --exclude "**/*.min.js,**/*.bundle.js"
Combining Include and Exclude
Section titled “Combining Include and Exclude”# Process TypeScript files but skip tests and node_modulesrenamify plan old_name new_name \ --include "**/*.ts,**/*.tsx" \ --exclude "**/*test*,node_modules/**"
Exclude Specific Matches
Section titled “Exclude Specific Matches”Use --exclude-match
to skip specific compound words or identifiers that match your pattern but shouldn’t be changed:
# Skip specific compound words that contain your patternrenamify plan foo bar --exclude-match bazFooQux,FooService
# Useful when a pattern accidentally matches unintended identifiersrenamify 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
Exclude Lines by Pattern
Section titled “Exclude Lines by Pattern”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:
Skip Comments
Section titled “Skip Comments”# 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 commentsrenamify plan old_name new_name --exclude-matching-lines '^\s*(//|/\*)'
Skip TODO/FIXME Markers
Section titled “Skip TODO/FIXME Markers”# Skip lines containing TODO or FIXMErenamify plan old_name new_name --exclude-matching-lines '(TODO|FIXME)'
# Skip lines with any common code markersrenamify plan old_name new_name --exclude-matching-lines '(TODO|FIXME|HACK|NOTE|XXX)'
Skip Debug or Test Code
Section titled “Skip Debug or Test Code”# Skip lines containing DEBUGrenamify plan old_name new_name --exclude-matching-lines 'DEBUG'
# Skip console.log statementsrenamify plan old_name new_name --exclude-matching-lines 'console\.(log|debug|error)'
# Skip test assertionsrenamify plan old_name new_name --exclude-matching-lines '(assert|expect|test|describe)\('
Advanced Patterns
Section titled “Advanced Patterns”# Skip Python linter directivesrenamify plan old_name new_name --exclude-matching-lines '#.*(pylint|type:|noqa)'
# Skip JSDoc commentsrenamify plan old_name new_name --exclude-matching-lines '^\s*\*'
# Skip lines with specific annotationsrenamify plan old_name new_name --exclude-matching-lines '@(deprecated|internal|ignore)'
Important Notes
Section titled “Important Notes”- 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
Glob Pattern Syntax
Section titled “Glob Pattern Syntax”Renamify uses standard glob patterns:
Pattern | Matches |
---|---|
* | 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 |
Examples
Section titled “Examples”# 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}*"
Binary File Handling
Section titled “Binary File Handling”Renamify automatically detects and skips binary files by default:
Detection Methods
Section titled “Detection Methods”- File extension:
.jpg
,.png
,.exe
, etc. - Content analysis: Checks for null bytes and non-UTF8 content
- Magic numbers: Recognizes common binary file headers
Override Binary Detection
Section titled “Override Binary Detection”# 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}"
Auto-Initialization
Section titled “Auto-Initialization”Renamify automatically prompts to ignore its workspace directory on first use:
Interactive Prompt
Section titled “Interactive Prompt”Renamify uses .renamify/ for plans, backups, and history.Ignore it now? [Y] Repo .gitignore [l] Local .git/info/exclude [g] Global excludesfile [n] NoChoice (Y/l/g/n):
Command-Line Control
Section titled “Command-Line Control”# Automatically add to .gitignore without promptingrenamify --auto-init=repo plan old new
# Prevent any auto-initializationrenamify --no-auto-init plan old new
# Use -y for non-interactive environments (CI)renamify -y plan old new
Performance Tips
Section titled “Performance Tips”Optimize Large Codebases
Section titled “Optimize Large Codebases”# Be specific with includes to avoid scanning unnecessary filesrenamify plan old new --include "src/**/*.{js,ts,tsx}"
# Exclude large directories earlyrenamify plan old new --exclude "node_modules/**,target/**,.git/**"
Parallel Processing
Section titled “Parallel Processing”Renamify automatically uses parallel directory traversal and file processing for optimal performance on large codebases.
Common Patterns
Section titled “Common Patterns”Frontend Projects
Section titled “Frontend Projects”# React/TypeScript projectrenamify rename oldName newName \ --include "src/**/*.{ts,tsx,js,jsx}" \ --exclude "**/*.test.*,**/__tests__/**,node_modules/**"
Rust Projects
Section titled “Rust Projects”# Rust project with testsrenamify rename old_name new_name \ --include "**/*.rs" \ --exclude "target/**"
Python Projects
Section titled “Python Projects”# Python with tests in separate directoryrenamify rename old_name new_name \ --include "**/*.py" \ --exclude "venv/**,__pycache__/**,*.pyc"
Documentation Only
Section titled “Documentation Only”# Only process markdown and text filesrenamify rename old_name new_name \ --include "**/*.{md,txt,rst}"