Mergify CLI
Mergify CLI is a command-line interface tool designed to automate the creation and management of stacked pull requests on GitHub. It also handles CI results upload and integrates with various GitHub workflows. The library maintains a rapid release cadence, often daily or weekly, with frequent updates and new features, currently at version 2026.4.14.1.
Common errors
-
mergify: command not found
cause The `mergify-cli` package is not installed, or its installation directory is not in your system's PATH.fixRun `pip install mergify-cli`. If it's already installed, ensure your PATH environment variable includes the directory where pip installs executables (e.g., `~/.local/bin` on Linux/macOS or `Scripts` folder in Python install on Windows). -
Error: GitHub token not found. Please run 'mergify setup'.
cause The Mergify CLI requires a GitHub Personal Access Token (PAT) for authentication, which was not found or is invalid.fixRun `mergify setup` interactively to configure your GitHub token, or set the `MERGIFY_TOKEN` environment variable manually (e.g., `export MERGIFY_TOKEN='ghp_YOUR_TOKEN'`). Ensure the token has sufficient scopes (e.g., `repo`, `workflow`). -
Error: Unknown command 'reviews'
cause You are attempting to use a command (`reviews`) that has been removed from the Mergify CLI.fixThe `reviews` command was removed in version `2026.3.11.1`. Consult the latest documentation or release notes for available commands. Do not use this command in new scripts or try to remove it from existing ones. -
Error: failed to checkout stack 'my-feature': no stack named 'my-feature' found
cause The stack name provided to `mergify stack checkout` does not exist in your current repository context, or you mistyped the name. This can also happen if the stack was recently deleted or merged.fixVerify the correct name of the stack. Use `mergify stack status` to list active stacks or `git branch` to see local branches. Ensure you are in the correct repository.
Warnings
- breaking The `mergify stack github_action_auto_rebase` command has been removed.
- breaking The `mergify reviews` command has been reverted and removed.
- breaking The `mergify stack checkout` command now takes a positional `NAME` argument.
- gotcha Previous versions of `mergify stack push` could unintentionally delete similarly named branches.
Install
-
pip install mergify-cli
Quickstart
# 1. Install mergify-cli pip install mergify-cli # 2. Set up your GitHub token (replaces MERGIFY_TOKEN with your actual token) # or run `mergify setup` for interactive configuration. export MERGIFY_TOKEN="ghp_YOUR_GITHUB_TOKEN" # 3. Initialize Mergify CLI in your Git repository # This will guide you through connecting to GitHub. mergify setup # 4. Create and push a stacked pull request # (Assuming you have local commits on a feature branch) mergify stack push # 5. Check the status of your current stack mergify stack status # 6. Checkout a specific stack by name # mergify stack checkout my-feature-stack