EnterWorktree: reuse existing worktree if one already exists for the branch

Resolved 💬 1 comment Opened Apr 8, 2026 by sunaemon Closed Apr 8, 2026

Problem

When a git worktree already exists (e.g. created manually via git worktree add), EnterWorktree cannot switch into it. It only creates new worktrees with new branches based on HEAD.

Expected behavior

If a worktree already exists for the target branch/name, EnterWorktree should detect it and switch the session's working directory to the existing worktree instead of failing or creating a new one.

Use case

  1. User creates a worktree manually: git worktree add worktrees/my-branch my-branch
  2. User wants Claude Code to work in that worktree
  3. Currently there's no way to enter the existing worktree — EnterWorktree only creates new ones

Suggested behavior

  • Accept an optional branch or path parameter to target an existing worktree
  • If a worktree with the given name/branch already exists, switch into it rather than erroring

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗