Skip to content

renamify rename

The rename command is the fastest way to rename terms in your codebase. It combines planning and applying in a single interactive command with preview and confirmation.

Terminal window
renamify rename <OLD> <NEW> [PATHS]... [OPTIONS]
  • <OLD> - Old identifier to replace
  • <NEW> - New identifier to replace with
  • [PATHS]... - Search paths (files or directories)
  • --preview <FORMAT> - Show preview before confirmation (table, diff, json, none) [default: table]
  • --dry-run - Show preview only, don’t apply changes
  • --large - Acknowledge large changes (>500 files or >100 renames)
  • --include <PATTERNS> - Only process files matching these glob patterns
  • --exclude <PATTERNS> - Skip files matching these glob patterns
  • --no-rename-files - Don’t rename matching files
  • --no-rename-dirs - Don’t rename matching directories
  • --rename-root - Allow renaming the root project directory (requires confirmation)
  • --no-rename-root - Never rename the root project directory
  • --exclude-styles <STYLES> - Exclude specific case styles from the default set
  • --include-styles <STYLES> - Add additional case styles to the active set
  • --only-styles <STYLES> - Use only these case styles, ignoring defaults
  • --exclude-match <PATTERNS> - Skip specific matches (e.g., compound words to ignore)
  • --exclude-matching-lines <REGEX> - Skip matches on lines matching this regex pattern
  • --no-acronyms - Disable acronym detection and transformation
  • --include-acronyms <ACRONYMS> - Add custom acronyms to detect (e.g., “API,URL”)
  • --exclude-acronyms <ACRONYMS> - Exclude specific acronyms from detection
  • --only-acronyms <ACRONYMS> - Only use these acronyms, ignore defaults
  • --fixed-table-width - Use fixed column widths in table output for consistent formatting
  • --commit - Create a git commit after applying changes
  • --force-with-conflicts - Force apply even with conflicts
  • --confirm-collisions - Confirm case-insensitive or collision renames
  • -u - Disable .gitignore files
  • -uu - Disable all ignore files, include hidden files
  • -uuu - Disable all ignore files, include hidden files, process binary files
Terminal window
# Rename with automatic preview and confirmation
renamify rename getUserName fetchUserProfile
# Or specify specific paths
renamify rename getUserName fetchUserProfile src/ tests/
Terminal window
# Only process TypeScript files using patterns
renamify rename oldName newName --include "**/*.{ts,tsx}"
# Or use specific paths
renamify rename oldName newName src/components/ src/utils/
Terminal window
# Skip test files and node_modules
renamify rename oldApi newApi \
--exclude "**/*test*,node_modules/**"
Terminal window
# Only handle camelCase and PascalCase (common in React projects)
renamify rename oldComponent newComponent \
--only-styles camel,pascal
Terminal window
# Automatically commit changes after applying
renamify rename old_function new_function --commit
Terminal window
# Rename entire project including root directory
renamify rename myproject awesome_project \
--rename-root \
--commit
Terminal window
# Skip compound words that contain your pattern
renamify rename config settings \
--exclude-match ConfigurationManager,ConfigService

When you run rename, this is what happens:

  1. Scanning: Renamify scans your codebase for matches
  2. Preview: Shows a table/diff of all planned changes
  3. Confirmation: Prompts “Apply these changes? [y/N]:”
  4. Apply: If confirmed, applies changes atomically
  5. Results: Shows operation ID for potential undo
Terminal window
$ renamify rename getUserName fetchUserProfile
Files to modify: 12
┌─────────────────────────────────────┬──────────┬────────────────────┬─────────────────────┐
File Lines Old New
├─────────────────────────────────────┼──────────┼────────────────────┼─────────────────────┤
src/auth.js 23, 45 getUserName fetchUserProfile
src/auth.js 12 get_user_name fetch_user_profile
components/UserProfile.tsx 89 GetUserName FetchUserProfile
└─────────────────────────────────────┴──────────┴────────────────────┴─────────────────────┘
Files to rename: 2
┌─────────────────────────────────────┬─────────────────────────────────────┐
Current Path New Path
├─────────────────────────────────────┼─────────────────────────────────────┤
utils/get-user-name.js utils/fetch-user-profile.js
tests/getUserName.test.js tests/fetchUserProfile.test.js
└─────────────────────────────────────┴─────────────────────────────────────┘
Apply these changes? [y/N]: y
Applied successfully! Operation ID: abc123-20241201-143022

Use rename when:

  • Making smaller, focused changes
  • You want immediate feedback and confirmation
  • Working interactively and want speed
  • The preview looks correct and you’re confident

Use plan/apply when:

  • Making large, complex renaming operations
  • You need time to review the plan thoroughly
  • Working with teammates who need to review changes
  • You want to save and potentially modify the plan

The rename command includes all of Renamify’s safety features:

  • Atomic operations: All changes succeed or none do
  • Automatic backups: Created before applying changes
  • Conflict detection: Warns about potential issues
  • Undo support: Use renamify undo <id> to revert
  • 0 - Success
  • 1 - Conflicts detected (use --force-with-conflicts to override)
  • 2 - Invalid input or arguments
  • 3 - Internal error or system issue