Stacked Pull Requests

Create, reorder, sync, and push stacked pull requests entirely from git.


mergify stack checkout #

Checkout the pull requests stack

mergify stack checkout [OPTIONS] <NAME>
<NAME> string required
--author <AUTHOR> string

Author of the stack. Defaults to the token's user

--repository <REPOSITORY> string

owner/repo. Falls back to the URL of --trunk's remote

--branch <BRANCH> string

Local branch name. Defaults to the normalised NAME

--branch-prefix <BRANCH_PREFIX> string

Override the stack branch prefix

-n, --dry-run flag

Show the plan without checking out

-t, --trunk <TRUNK> string

Target trunk as REMOTE/BRANCH. Defaults to the resolved trunk for the current branch

--token <TOKEN> string

GitHub token (falls back to MERGIFY_TOKEN / GITHUB_TOKEN / gh auth token)

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack drop #

Drop commits from the stack

mergify stack drop [OPTIONS] <COMMITS>...
<COMMITS>... string required repeatable

Commits to drop. Each accepts a SHA prefix or a Change-Id prefix

-n, --dry-run flag

Show the plan without dropping

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack edit #

Edit the stack history

mergify stack edit [COMMIT]
<COMMIT> string optional

Commit to pause the rebase on. Accepts a SHA prefix or a Change-Id prefix; omit for a fully interactive rebase

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack fixup #

Fixup commits into their parent (drops their messages)

mergify stack fixup [OPTIONS] <COMMITS>...
<COMMITS>... string required repeatable
-n, --dry-run flag

Show the plan without rebasing

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack hooks #

Show git hooks status and manage installation

mergify stack hooks [OPTIONS]
--setup flag

Install or upgrade hooks

-f, --force flag

Force reinstall wrappers (use with --setup)

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack list #

List the stack's commits and their associated PRs

mergify stack list [OPTIONS]
--author <AUTHOR> string
--repository <REPOSITORY> string
--branch-prefix <BRANCH_PREFIX> string
-t, --trunk <TRUNK> string
--token <TOKEN> string
--json flag

Emit machine-readable JSON

-v, --verbose flag

Show per-check / per-reviewer detail

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack move #

Move a commit within the stack

mergify stack move [OPTIONS] <COMMIT> <POSITION> [TARGET]
<COMMIT> string required

Commit to move

<POSITION> first | last | before | after required

Where to put it: first, last, before, after

Values: first last before after

<TARGET> string optional

Required when position is before or after

-n, --dry-run flag

Show the plan without moving

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack new #

Create a new stack branch

mergify stack new [OPTIONS] <NAME>
<NAME> string required

Name of the new branch

-b, --base <BASE> string

Base branch to fork from, formatted as REMOTE/BRANCH (e.g. origin/main). When omitted, the trunk is resolved from the current branch's tracking info or refs/remotes/origin/HEAD

--checkout flag

Checkout the new branch after creation. This is the default. Pass --no-checkout to keep the current branch checked out

--no-checkout flag

Leave the current branch checked out and just create the new branch ref

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack note #

Attach a 'why was this commit amended' note to a commit

mergify stack note [OPTIONS] [COMMIT]
<COMMIT> string optional

Target commit. Accepts a SHA prefix, a ref (HEAD~1, branch name, …), or a Change-Id prefix (resolved against the stack walk). Defaults to HEAD

-m, --message <MESSAGE> string

Note message. If omitted, opens $GIT_EDITOR / $VISUAL / $EDITOR / vi on a tempfile

--append flag

Append to an existing note instead of replacing

--remove flag

Remove the note on the target commit. Mutually exclusive with --message and --append

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack open #

Open a PR from the stack in the browser

mergify stack open [OPTIONS] [COMMIT]
<COMMIT> string optional
--author <AUTHOR> string
--repository <REPOSITORY> string
--branch-prefix <BRANCH_PREFIX> string
-t, --trunk <TRUNK> string
--token <TOKEN> string
--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack push #

Push/sync the stack's pull requests on GitHub

mergify stack push [OPTIONS]
--author <AUTHOR> string
--repository <REPOSITORY> string
--branch-prefix <BRANCH_PREFIX> string
-t, --trunk <TRUNK> string
--token <TOKEN> string
-R, --skip-rebase flag

Skip the rebase step. By default stack push rebases on trunk before pushing when there are no approvals to dismiss

--force-rebase flag

Force the rebase even when PRs are approved (the rebase will dismiss the reviews). Mutually exclusive with --skip-rebase

-x, --next-only flag

Only push the bottom commit of the stack

-n, --dry-run flag

Dry-run: render the plan + the rebase decision and exit

-d, --draft flag

Open new PRs as drafts. Default falls back to git config mergify-cli.stack-create-as-draft (false when unset)

-k, --keep-pull-request-title-and-body flag

Don't rewrite the PR title + body from the commit message; only update the rendered Depends-On chain in the body. Default falls back to git config mergify-cli.stack-keep-pr-title-body (false when unset)

-u, --only-update-existing-pulls flag

Don't create new PRs; surface would-be-created ones in the plan instead

--no-revision-history flag

Suppress the revision-history sticky comment update. Default falls back to git config mergify-cli.stack-revision-history (true when unset)

--no-verify flag

Pass --no-verify to git push (skips local pre-push hooks)

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack reorder #

Reorder the stack's commits

mergify stack reorder [OPTIONS] <COMMITS>...
<COMMITS>... string required repeatable
-n, --dry-run flag

Show the plan without reordering

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack reword #

Change a commit's message

mergify stack reword [OPTIONS] <COMMIT>
<COMMIT> string required
-m, --message <MESSAGE> string

New message. When omitted, git rebase -i pauses at the target and opens $GIT_EDITOR

-n, --dry-run flag

Show the plan without rebasing

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack setup #

Configure git hooks (alias for 'stack hooks --setup')

mergify stack setup [OPTIONS]
-f, --force flag

Force reinstall of hook wrappers, even if user modified them

--check flag

Check status only (use 'stack hooks' instead)

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack squash #

Squash commits into a target commit

mergify stack squash [OPTIONS] <TOKENS> <TOKENS> <TOKENS>...
<TOKENS>... string required repeatable

SRC1 SRC2 ... into TARGET — must contain exactly one into token; everything before is a source, the single token after is the target

-m, --message <MESSAGE> string

Final commit message (required to rename; otherwise the target's message is kept)

-n, --dry-run flag

Show the plan without rebasing

--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

mergify stack sync #

Sync the stack: fetch trunk, remove merged commits, rebase

mergify stack sync [OPTIONS]
--author <AUTHOR> string
--repository <REPOSITORY> string
--branch-prefix <BRANCH_PREFIX> string
-n, --dry-run flag
-t, --trunk <TRUNK> string
--token <TOKEN> string
--debug flag

Enable verbose debug logging. Mirrors the Python CLI's top-level --debug flag so the same invocations work against either binary; native commands accept it as a no-op today (no native code path consults it yet), shimmed ones re-inject it into the forwarded argv so the Python side can honor it

Was this page helpful?