View as Markdown

Rebase

Rebase the pull request on top of its base branch.


The rebase action makes Mergify rebase the pull request on top of its base branch. This is useful when you want to ensure that your pull request is always up-to-date with the latest changes from the base branch.

Whatever your conditions are, Mergify adds its own requirements before running the action. A pull request is rebased only when it is open, has no conflict, is not in a merge queue (queue-position = -1), and is either behind its base branch (#commits-behind > 0) or does not have a linear history (-linear-history).

A pull request opened from another repository whose head branch Mergify cannot write at all, such as one whose fork has been deleted, is refused for that reason rather than the one above, and the check run says so. The update action covers those cases, which refuse update too.

Rebasing always acts as a GitHub user. With no bot_account set, that user is the pull request author, or whoever posted the @mergifyio rebase command when a command triggered the rebase. The account must have signed in to the Mergify dashboard at least once.

That account cannot be a bot: Mergify cannot impersonate an account owned by another GitHub App. The action fails whenever the account it falls back to is one, whether a GitHub App opened the pull request, such as a dependency update bot, or posted the command. Set bot_account to a user account to rebase those.

bot_account#Bot account or null·defaultnull

To rebase, Mergify needs to impersonate a GitHub user. You can specify the account to use with this option. If no bot_account is set, Mergify picks the pull request author, or the user who sent the @mergifyio rebase command. The user account must have already been logged in Mergify dashboard once.

Warning: Because of GitHub's security restrictions, Mergify cannot impersonate an account owned by another GitHub App. A rebase therefore fails whenever the account it falls back to is a bot, either because the pull request was opened by one or because one sent the command, unless bot_account names a user account.

Warning: A pull request coming from a fork cannot be rebased, whether or not this option is set: rebasing one means impersonating a GitHub user to force-push the contributor's branch. Use the update action or the @mergifyio update command on those -- except where Mergify cannot write the head branch at all, such as a deleted fork, where update is refused too and the check run says what is wrong.

Rebase a pull request when it gets the ready-to-merge label.

pull_request_rules:
- name: rebase when ready to merge
conditions:
- label = ready-to-merge
actions:
rebase:

Was this page helpful?