feat: allow selecting remote branches in new worktree#287
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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).WorktreeService#getBranchesWithRemotesEffect()returns local and remote branches separately, using each configured remote's prefix (not just hard-codedorigin/).NewWorktreenow uses the existinguseDynamicLimithook (the same oneMenuuses) so the branch list grows with terminal height instead of being hard-capped at 10.fixedRowsis bumped by 2 when the remote-inclusion tip is visible.Test plan
npm run typechecknpm run lintnpm run testNew Worktree, confirmorigin/<default>appears as(default remote)right below the default local branch and other remote refs appear at the bottom of the list.🤖 Generated with Claude Code