Skip to content

feat: allow selecting remote branches in new worktree#287

Merged
kbwo merged 2 commits intomainfrom
feature/remote-branch-selection
Apr 19, 2026
Merged

feat: allow selecting remote branches in new worktree#287
kbwo merged 2 commits intomainfrom
feature/remote-branch-selection

Conversation

@kbwo
Copy link
Copy Markdown
Owner

@kbwo kbwo commented Apr 19, 2026

Summary

  • Add an Include Remote Branches toggle under Configure Worktree Settings. When on, NewWorktree's base-branch selector shows remote refs (e.g. origin/main) alongside local branches. The default branch's remote is placed directly after the default local branch and labeled (default remote).
  • New WorktreeService#getBranchesWithRemotesEffect() returns local and remote branches separately, using each configured remote's prefix (not just hard-coded origin/).
  • NewWorktree now uses the existing useDynamicLimit hook (the same one Menu uses) so the branch list grows with terminal height instead of being hard-capped at 10. fixedRows is bumped by 2 when the remote-inclusion tip is visible.
  • Shows a dim tip in the base-branch step suggesting users disable the option in Configuration if the list feels slow.

Test plan

  • npm run typecheck
  • npm run lint
  • npm run test
  • Manual: enable "Include Remote Branches" in Configure Worktree Settings, open New Worktree, confirm origin/<default> appears as (default remote) right below the default local branch and other remote refs appear at the bottom of the list.
  • Manual: disable the setting, confirm the list returns to local-only behaviour.
  • Manual: resize the terminal while on the base-branch step — the visible slice should grow/shrink instead of staying at 10 rows.

🤖 Generated with Claude Code

kbwo and others added 2 commits April 19, 2026 17:47
Add an "Include Remote Branches" setting in Configure Worktree Settings
so users can opt in to selecting remote refs (e.g. origin/main) as the
base branch. The default branch's remote is listed directly after the
default local branch, and NewWorktree shows a tip about disabling the
option if the branch list becomes slow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The base branch selector in NewWorktree was hard-capped at 10 entries,
which hides most branches once remote refs are included. Reuse the
existing useDynamicLimit hook (already used by Menu) so the visible
slice grows with the terminal height and shrinks when search mode or
the load-error banner take extra rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kbwo kbwo marked this pull request as ready for review April 19, 2026 09:55
@kbwo kbwo merged commit 53a3ea0 into main Apr 19, 2026
1 check passed
@kbwo kbwo deleted the feature/remote-branch-selection branch April 19, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant