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). With autosquash enabled, holding more than one commit (#commits > 1) is a third way to satisfy that either/or requirement.

Rebasing writes the pull request’s head branch, so the restrictions on writing a fork’s branch apply here too.

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. The user account must have already been logged in Mergify dashboard once.

Warning: Due to security on GitHub side, rebase cannot be performed on pull requests created by bot accounts without explicitly setting the bot_account impersonation option.

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?