Skip to content

[Feature Request] specify custom worktree directory name independent of branch name #1982

@christowiz

Description

@christowiz

Problem

When creating a new worktree with wt switch --create, the worktree directory name is always derived from the branch name. For branches using / separators (e.g. feature/JIRA-1234), the slash is sanitized to a dash, giving a directory like feature-JIRA-1234. There is no way to specify a different directory name on the command line.

Example:

  • wt switch --create feature/JIRA-1234 → directory feature-JIRA-1234, branch feature/JIRA-1234

If I want the directory to be named something descriptive like navigation-animation-refactor while the branch is feature/JIRA-1234, there's currently no way to do this.

Desired behavior

An option (e.g. --path or --name) that lets you specify the worktree directory path independently of the branch name:

wt switch --create feature/JIRA-1234 --path navigation-animation-refactor

This would create a branch called feature/JIRA-1234 with the worktree at a directory called navigation-animation-refactor — exactly what git worktree add already supports:

git worktree add -b feature/JIRA-1234 ../navigation-animation-refactor
# or
git worktree add ../navigation-animation-refactor feature/JIRA-1234

Workaround

Today the only workaround is to drop down to git worktree add directly, which bypasses all of worktrunk's hooks, path templating, and shell integration.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions