Skip to content

Allow configuring default base branch for --worktree #35730

Description

@mechastriker3

When using claude --worktree, the new worktree branches from the current HEAD. If I'm checked out to a feature branch or inside another worktree, the new worktree is based on that branch instead of the remote default (e.g., origin/main).

Problem

In my workflow, I often invoke claude -w while already on a feature branch. This means the worktree starts from that branch's state rather than the latest origin/main, which is almost never what I want. I have to remember to switch to main first, or manually create the worktree with git commands.

Proposed solution

Add a worktree.baseBranch setting in settings.json:

{
  "worktree": {
    "baseBranch": "origin/main"
  }
}

When set, claude --worktree would always create the new worktree from the specified ref, regardless of the current checkout. When unset, behavior stays as-is (branch from current HEAD).

Workaround

Manually creating the worktree and launching Claude inside it:

git worktree add .claude/worktrees/my-task -b my-task origin/main
cd .claude/worktrees/my-task && claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions