Auto-select stack when current branch is only in that stack #370
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.
This PR implements automatic stack selection when the current branch exists in exactly one stack, eliminating the need for manual stack selection in common workflows.
Problem
Previously, users had to manually select a stack from a list even when they were working on a branch that only existed in one stack. This created unnecessary friction, especially when running multiple commands in sequence.
Solution
The stack selection logic now automatically selects a stack when the current branch is only in one stack for the remote. This mirrors Git's behavior where commands operate on the current context without requiring explicit specification.
Key Changes
SelectStackmethod: Added logic to detect when the current branch exists in exactly one stack and auto-select itIsCurrentStackmethod: Now correctly identifies when a user is on the source branch of a stack (previously only checked child branches)Behavior
--stackflag, single stack scenarios)Example
Users can still specify
--stackexplicitly when they want to operate on a different stack than the one containing their current branch.Fixes #369.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.