Syntax
Options
Optional worktree and branch name. If not provided, the name is automatically generated by sanitising the source branch name (lowercase, alphanumeric characters and hyphens only).
Create worktree from the specified branch. If not provided, uses the current branch from the working directory.
Create worktree from PR number. Fetches the specified PR and generates the worktree name from
pr_branch_name_template.PR Creation Behavior: The worktree always uses the generated name. The local branch name is conditional: if you are the PR author, lazyworktree keeps the PR branch name; otherwise it uses the generated name. When requester identity cannot be resolved, lazyworktree falls back to the PR branch name.Create worktree from issue number. Fetches the specified issue and creates a worktree with a sanitised branch name derived from the
issue_branch_name_template (default: issue--). Uses the current branch as the base; combine with --from-branch to specify a different base.Interactively select an open issue to create a worktree from. When
fzf is installed, presents a searchable list with issue body preview; otherwise displays a numbered list for selection. Combine with --from-branch to specify a base branch.Interactively select an open pull request to create a worktree from. When
fzf is installed, presents a searchable list with PR metadata preview; otherwise displays a numbered list for selection.Pre-filter the interactive selection list. Requires
-I or -P. When fzf is available, the search box is pre-filled with the given string; otherwise the numbered list is filtered to items containing the string (case-insensitive).Generate worktree name automatically from the current branch name. Cannot be used with a positional name argument or with
--from-pr-interactive. Sanitises the branch name to be Git-compatible (lowercase, alphanumeric characters and hyphens only).Carry over uncommitted changes to the new worktree. Works with current branch or
--from-branch. Cannot be used with --from-pr or --from-issue. Stashes changes from current worktree, creates new worktree, and applies the stash.Skip worktree creation entirely. Instead, creates a local branch and switches to it in the current working directory. Must be used with
--from-pr, -P, --from-issue, or -I. Outputs the branch name rather than a worktree path.Run a shell command after creation. The command runs in the created worktree directory, or in the current directory when used with
--no-workspace. Shell mode follows your current shell (zsh -ilc, bash -ic, otherwise -lc).Suppress all progress messages to stderr. Only the worktree path is written to stdout unless
--output-selection is used.Write the created worktree path to a file. When set, stdout output is suppressed.