Stacked Pull Requests
Create, reorder, sync, and push stacked pull requests entirely from git.
Learn more: Stacked pull requests
mergify stack new #
Create a new stack branch.
Create a branch that tracks your trunk and start a fresh stack on top of it. The new branch is checked out by default; pass --no-checkout to only create the ref and stay on the current 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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack note #
Attach a note explaining why a commit was amended.
Record a note on a stack commit describing why it changed; the note is surfaced when reviewing the stack. Edit it in your editor or pass -m, add to an existing note with --append, or clear it with --remove. Defaults to the commit at HEAD.
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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack edit #
Edit a commit in the stack. Pause an interactive rebase on the target commit so you can amend it, then resume. Omit the commit to start a fully interactive rebase of the whole stack.
mergify stack edit [OPTIONS] [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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack drop #
Drop commits from the stack.
Remove one or more commits from the stack and rebase the commits above them down. Each accepts a SHA prefix or a Change-Id prefix. Use --dry-run to preview the resulting order first.
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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack fixup #
Fold commits into their parent.
Squash each given commit into the commit below it, discarding the folded commit's message (the parent's message is kept). Each accepts a SHA prefix or a Change-Id prefix. Use --dry-run to preview.
mergify stack fixup [OPTIONS] <COMMITS>...
<COMMITS>...
string
required
repeatable
Commits to fold into their parent
-n, --dry-run
flag
Show the plan without rebasing
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack reword #
Change a commit's message.
Rewrite the message of a commit in the stack. Pass -m to set the new message inline, or omit it to edit the message in your editor. Use --dry-run to preview.
mergify stack reword [OPTIONS] <COMMIT>
<COMMIT>
string
required
Commit to reword. Accepts a SHA prefix or a Change-Id prefix
-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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack reorder #
Reorder the stack's commits.
Rebase the stack into the commit order you list. Commits you don't mention keep their relative order. Each accepts a SHA prefix or a Change-Id prefix. Use --dry-run to preview.
mergify stack reorder [OPTIONS] <COMMITS>...
<COMMITS>...
string
required
repeatable
Commits in the order you want them rebased into
-n, --dry-run
flag
Show the plan without reordering
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack move #
Move a commit within the stack.
Move one commit to a new position in the stack: to the first or last slot, or before/after another commit (passed as TARGET). Use --dry-run to preview.
mergify stack move [OPTIONS] <COMMIT> <POSITION> [TARGET]
<COMMIT>
string
required
Commit to move. Accepts a SHA prefix or a Change-Id prefix
<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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack squash #
Squash commits into a target commit.
Fold one or more source commits into a target commit, reordering them adjacent to it first. Use the form SRC... into TARGET. Pass -m to set the combined message; otherwise the target's message is kept. Use --dry-run to preview.
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
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack checkout #
Check out a pull request stack from GitHub. Fetch a stack of pull requests by name and create a local branch that tracks its leaf, so you can continue working on a stack created elsewhere (a teammate's, or your own from another machine).
mergify stack checkout [OPTIONS] <NAME>
<NAME>
string
required
Name of the stack to check out
--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)
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack sync #
Sync the stack with its trunk.
Fetch the latest trunk, drop commits whose pull request has already merged, and rebase the remaining stack on top. Use --dry-run to preview.
mergify stack sync [OPTIONS]
--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-prefix
<BRANCH_PREFIX>
string
Override the stack branch prefix
-n, --dry-run
flag
Show the plan without changing anything
-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)
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack push #
Push the stack and create or update its pull requests.
Walk the local stack, optionally rebase it on trunk, push each commit to its own branch, and create or update the matching pull request and its Depends-On chain on GitHub. Use --dry-run to preview the plan and the rebase decision without touching anything.
mergify stack push [OPTIONS]
--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-prefix
<BRANCH_PREFIX>
string
Override the stack branch prefix
-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)
-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)
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack list #
List the stack's commits and their pull requests.
Show each commit in the current stack alongside its pull request, CI, and review state. Pass --verbose for per-check and per-reviewer detail, or --json for machine-readable output.
mergify stack list [OPTIONS]
--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-prefix
<BRANCH_PREFIX>
string
Override the stack branch prefix
-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)
--json
flag
Emit machine-readable JSON
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack open #
Open a stack commit's pull request in the browser. Open the GitHub pull request for a commit in the stack in your default browser. Defaults to the commit at HEAD.
mergify stack open [OPTIONS] [COMMIT]
<COMMIT>
string
optional
Commit whose pull request to open. Accepts a SHA prefix or a Change-Id prefix; defaults to HEAD
--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-prefix
<BRANCH_PREFIX>
string
Override the stack branch prefix
-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)
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack hooks #
Show or install the stack git hooks.
Report the status of the git hooks that keep Change-Id trailers on your commits (stacks rely on them to track commits across rebases). Pass --setup to install or upgrade them.
mergify stack hooks [OPTIONS]
--setup
flag
Install or upgrade hooks
-f, --force
flag
Force reinstall wrappers (use with --setup)
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
mergify stack setup #
Install the stack git hooks.
Install or upgrade the git hooks that add Change-Id trailers to your commits. This is an alias for stack hooks --setup; pass --check to report status instead of installing.
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)
-v, --verbose
flag
Increase log verbosity: -v info, -vv debug, -vvv trace. Logs go to stderr so stdout stays clean for piping. RUST_LOG overrides this
--debug
flag
Shorthand for at least debug-level logging (like -vv)
--color
<COLOR>
auto | always | never
When to use color in terminal output
Values:
auto
always
never
Was this page helpful?
Thanks for your feedback!