Conversation
This adds a `-y/--yes` flag to `gh stack sync` which accepts the default behavior when a branch has been merged into the trunk (which is to delete the branch).
Owner
Author
📚 Pull Request Stack
Managed by gh-stack |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a -y/--yes flag to gh stack sync to automatically accept the default handling for branches detected as merged into trunk (deleting the merged branch) without prompting, aligning sync behavior with non-interactive defaults.
Changes:
- Add
-y/--yesflag wiring togh stack sync, and thread it into merged-branch handling to skip the interactive prompt. - Document the new flag in the README sync command options table.
- Add tests to ensure the flag appears in
sync --helpoutput, plus an internal helper test for merged-branch handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents the new -y/--yes flag for gh stack sync. |
| e2e/sync_test.go | Adds an e2e help-output assertion that --yes is exposed. |
| cmd/sync.go | Implements --yes flag and bypasses the merged-branch prompt when set. |
| cmd/sync_internal_test.go | Adds internal test coverage around merged-branch handling with a yes parameter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+15
to
+18
| // TestHandleMergedBranchYesDeletes verifies that passing yes=true causes | ||
| // handleMergedBranch to delete the branch and clear stack config without | ||
| // showing an interactive prompt, even when stdin/stdout are a TTY. | ||
| func TestHandleMergedBranchYesDeletes(t *testing.T) { |
Comment on lines
+69
to
+72
| branchOut, _ := exec.Command("git", "-C", dir, "branch", "--list", "feature-a").Output() | ||
| if len(strings.TrimSpace(string(branchOut))) != 0 { | ||
| t.Errorf("expected feature-a to be deleted, but git branch still shows: %q", string(branchOut)) | ||
| } |
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.
This adds a
-y/--yesflag togh stack syncwhich accepts the default behavior when a branch has been merged into the trunk (which is to delete the branch).