Skip to main content
Rename a worktree directory without launching the TUI. The branch is renamed only if the current worktree directory name matches the branch name.

Syntax

lazyworktree rename [old-name] new-name

Arguments

new-name
string
required
New worktree name. It is sanitised to lowercase letters, numbers, and hyphens. When given as the only argument, the current worktree (detected from the working directory) is renamed.
old-name
string
The worktree path, branch name, or directory name to rename. If omitted, auto-detects the current worktree from the working directory.
--silent
boolean
Suppress all progress messages to stderr. Useful for scripting and automation.

Examples

# Rename current worktree (detected from cwd)
lazyworktree rename new-feature-name

# Rename by name
lazyworktree rename feature new-feature-name

# Rename by path
lazyworktree rename /path/to/worktree new-worktree-name

Notes

  • The branch is renamed only when the current worktree directory name matches the branch name
  • Shell completion suggests available worktree basenames for the first argument

Build docs developers (and LLMs) love