Skip to content

feat(sync): add -y/--yes flag#136

Open
boneskull wants to merge 1 commit into
mainfrom
sync-yes
Open

feat(sync): add -y/--yes flag#136
boneskull wants to merge 1 commit into
mainfrom
sync-yes

Conversation

@boneskull

Copy link
Copy Markdown
Owner

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).

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).
Copilot AI review requested due to automatic review settings July 11, 2026 00:20
@boneskull

Copy link
Copy Markdown
Owner Author

📚 Pull Request Stack


Managed by gh-stack

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/--yes flag wiring to gh 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 --help output, 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 thread cmd/sync_internal_test.go
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 thread cmd/sync_internal_test.go
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))
}
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.

2 participants