mergify-stack

Manages stacked pull requests by mapping git commits to PRs via the Mergify CLI.

32|11|Updated May 17, 2021
One-click install
npx skills add https://github.com/Mergifyio/mergify-cli --skill mergify-stack-mergifyio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mergify-stack
Source: https://github.com/Mergifyio/mergify-cli/tree/main/skills/mergify-stack
Command: npx skills add https://github.com/Mergifyio/mergify-cli --skill mergify-stack-mergifyio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing stacked pull requests manually with git rebase and gh commands is error-prone: PR titles drift from commit messages, interactive rebases hang in agent sessions, and fix commits create unwanted extra PRs. This Skill enforces a consistent stacked-PR workflow where every commit maps to one PR and the entire PR lifecycle is driven by commit messages. ## Core Features & Use Cases - Stacked PR creation and sync: Use mergify stack push to turn local commits into stacked PRs, mergify stack sync to rebase onto trunk and drop merged commits, and mergify stack list to inspect commit-to-PR mapping with CI and review status. - Non-interactive history rewriting: Reorder, move, fixup, squash, reword, edit, and drop commits with dedicated mergify stack subcommands instead of git rebase -i, which hangs in agent contexts. - Amend notes and revision history: Attach mergify stack note reasons before pushing so reviewers see why a commit was amended in the PR's revision history. - Use Case: You need to fix a lint error in the middle of a five-commit stack. Stash changes, run mergify stack edit <SHA>, amend the commit, continue the rebase, add a note explaining the fix, and push — all PRs update in place. ## Quick Start Check the current branch with git, create a new stack with mergify stack new feat/my-change, commit your work, then run mergify stack push to create the stacked pull requests.

Frequently Asked Questions about mergify-stack

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create stacked pull requests from git commits?

Create a branch with mergify stack new, make commits following conventional commit format, then run mergify stack push. Each commit becomes its own PR, with the commit message title and body copied to the PR title and body.

How do I amend a commit in the middle of a stack?

Stash local changes with git stash -u, run mergify stack edit with the commit SHA prefix to pause the rebase, amend with git commit --amend, run git rebase --continue, then mergify stack push. Never use git rebase -i, which hangs in agent sessions.

Can I edit a stacked PR title with gh pr edit?

No. PR titles and bodies are regenerated from commit messages on every mergify stack push, so manual edits with gh pr edit or the GitHub API are overwritten. Edit the commit message instead, then push again.

Why does mergify stack push fail on the main branch?

The push command refuses to run on the repository's default branch because stacks must live on feature branches. Create a branch first with mergify stack new <name> before committing any work.

What happens to uncommitted changes during stack reorder or sync?

Uncommitted changes can be silently lost or cause rebase conflicts during reorder, move, fixup, squash, checkout, or sync operations. Always run git stash -u before these commands and git stash pop afterward.

How do I explain why I amended an already-pushed commit?

Run mergify stack note -m "reason" after amending and before mergify stack push. The note appears in the PR's revision history comment and a JSON marker, so reviewers see why the commit changed without diffing SHAs.