Skip to content

feat: configurable merge method for /land-and-deploy#726

Open
peterarmstrong wants to merge 1 commit intogarrytan:mainfrom
peterarmstrong:feature/configurable-merge-method
Open

feat: configurable merge method for /land-and-deploy#726
peterarmstrong wants to merge 1 commit intogarrytan:mainfrom
peterarmstrong:feature/configurable-merge-method

Conversation

@peterarmstrong
Copy link
Copy Markdown

@peterarmstrong peterarmstrong commented Mar 31, 2026

Summary

  • Adds three-tier merge method resolution to /land-and-deploy
  • Adds merge_method config key to gstack-config
  • /setup-deploy persists merge method to both CLAUDE.md and gstack-config

Problem

/land-and-deploy hardcodes gh pr merge --squash --delete-branch as the fallback when auto-merge is not available. The dry-run UI says "(from repo settings)" but nothing actually queries repo settings. Teams that preserve full commit history can't use /land-and-deploy without workarounds.

Solution: Three-Tier Merge Method Resolution

Priority Source How it works
1 (highest) User config gstack-config set merge_method merge — explicit override
2 GitHub repo settings gh api repos/{owner}/{repo} — if only one merge method is enabled, use it. If multiple allowed, prefer squash
3 (fallback) Default squash (unchanged from current behavior)

The --auto flag still takes first priority (respects repo settings + merge queues). The three-tier logic only applies when auto-merge is not available.

Usage

# Override for repos with no-squash policy
gstack-config set merge_method merge

# Or let it auto-detect from GitHub
# (if repo only allows merge commits, it picks that automatically)

Changes

File Change
bin/gstack-config Add merge_method to annotated config header with docs
land-and-deploy/SKILL.md.tmpl Three-tier resolution: config > repo API > squash default
setup-deploy/SKILL.md.tmpl Persist merge method to gstack-config on configure
*/SKILL.md Regenerated from templates

Test plan

  • No config set + repo allows all methods → uses squash (unchanged default)
  • No config set + repo only allows merge commits → auto-detects and uses merge
  • gstack-config set merge_method merge → uses merge regardless of repo settings
  • /setup-deploy writes merge method to both CLAUDE.md and ~/.gstack/config.yaml
  • --auto still takes first priority when available (unchanged)

@peterarmstrong peterarmstrong marked this pull request as draft March 31, 2026 23:02
@peterarmstrong peterarmstrong force-pushed the feature/configurable-merge-method branch from 388bb97 to 91025de Compare March 31, 2026 23:06
Three-tier merge method resolution:
1. User config override (gstack-config set merge_method merge)
2. Auto-detect from GitHub repo settings via API
3. Default to squash (unchanged behavior)

/land-and-deploy now queries the repo's allowed merge methods via
gh api repos/{owner}/{repo}. If only one method is enabled, it uses
that. If multiple are allowed, it picks squash as the default.

Users can override with: gstack-config set merge_method merge

/setup-deploy now persists the merge method to both CLAUDE.md and
gstack-config so /land-and-deploy picks it up automatically.

This fixes the disconnect where the UI said '(from repo settings)'
but nothing actually queried repo settings. The --auto flag still
takes first priority (respects repo settings + merge queues), but
the direct fallback is now configurable instead of hardcoded.
@peterarmstrong peterarmstrong force-pushed the feature/configurable-merge-method branch from 91025de to 6d4c319 Compare March 31, 2026 23:22
@peterarmstrong peterarmstrong marked this pull request as ready for review April 1, 2026 00:19
@peterarmstrong
Copy link
Copy Markdown
Author

@garrytan This is a small vibe-coded thing to be able to change the default squash merge method (so I wouldn't have to fight the default behaviour), and expanded a bit. Please use anything that is helpful, and thanks so much for gstack!

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.

1 participant