Skip to content

issue:checkout: auto-select branch when only one exists#331

Merged
mglaman merged 2 commits intomainfrom
copilot/automatically-select-branch-in-checkout
Mar 24, 2026
Merged

issue:checkout: auto-select branch when only one exists#331
mglaman merged 2 commits intomainfrom
copilot/automatically-select-branch-in-checkout

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

When an issue fork has exactly one branch matching the {nid}-* pattern, the command forced an unnecessary interactive prompt or failed outright in non-interactive mode.

Changes

  • Auto-selection logic — if $issueBranches contains exactly one entry and no branch argument was supplied, skip the choice question entirely and proceed directly to checkout
  • User feedback — emit Auto-selected branch <name>. so the selection is visible and auditable in script output
  • No behaviour change for zero branches (error), multiple branches + interactive (choice question), or multiple branches + non-interactive (error with list)
Original prompt

This section details on the original issue you should resolve

<issue_title>If there is one branch, automatically select it in issue:checkout</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add automatic branch selection in issue:checkout issue:checkout: auto-select branch when only one exists Mar 24, 2026
Copilot AI requested a review from mglaman March 24, 2026 17:14
@mglaman mglaman marked this pull request as ready for review March 24, 2026 17:39
@mglaman mglaman merged commit f705b9e into main Mar 24, 2026
9 checks passed
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.

If there is one branch, automatically select it in issue:checkout

2 participants