View as Markdown

Mergify Rebase Command

Rebase a pull request.


The rebase command provides users with an instant method to instruct Mergify to rebase a pull request against its base branch. It’s a handy way to ensure that the pull request is updated with the latest changes from the base branch without manually triggering a rebase.

The rebase command lets developers keep their pull requests up-to-date and maintain a clean commit history.

The rebase command provided by Mergify has several advantages over the native GitHub rebase feature:

  • When the dismiss_reviews action is being used, it will not reset the reviews if the rebase is executed by Mergify.

  • It’s always available, whatever the repository configuration might be.

  • It can be restricted to certain users or teams.

To make use of the rebase command, simply comment on the desired pull request:

@mergifyio rebase
Posting '@mergifyio rebase' in GitHub interface

Mergify pushes the rebased branch as a GitHub user, not as itself. Unless a bot_account is configured, that user is whoever posted the command, and that account must have signed in to the Mergify dashboard at least once. If it has not, the command fails with Mergify can't impersonate.

A fork’s head branch lives in another repository, and Mergify can only force-push the rewritten branch there as the impersonated user, which is why the command is deprecated for fork pull requests. When the fork is private, rebase cannot run at all: GitHub does not let an app modify the head branch of a pull request opened from a private fork.

The update command merges the base branch instead of rewriting the head branch, and impersonates nobody unless you configure a bot_account, so it keeps working on pull requests opened from a fork.

Was this page helpful?