---
title: Mergify Rebase Command
description: 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.

<RebaseAdvantage />

:::caution
  This command does not rebase a pull request opened from a fork. It reports
  that the pull request cannot be rebased; use the
  [`update` command](/commands/update) on those instead.
:::

## Syntax

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

```text
@mergifyio rebase
```

<Image src={rebaseScreenshot} alt="Posting '@mergifyio rebase' in GitHub interface"/>

## Impersonation

Mergify pushes the rebased branch as a GitHub user, not as itself. Unless a
[`bot_account`](/configuration/data-types#bot-account) is configured, that user
is whoever posted the command, and that account must have signed in to the
[Mergify dashboard](https://dashboard.mergify.com) at least once. If it has
not, the command fails with `Mergify can't impersonate`.

That account cannot be a bot: Mergify cannot impersonate an account owned by
another GitHub App. When a GitHub App posts the command, the fallback account is
that bot, and the command fails. Set `bot_account` to a user account so the
command still runs.

A fork's head branch lives in another repository, and Mergify can only
force-push the rewritten branch there as the impersonated user. That is why
Mergify refuses the command on a pull request opened from a fork, even when
`bot_account` is set: the account it names would be the one force-pushing a
contributor's branch.

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 instead, and the check run says so. [The `update`
action](/workflow/actions/update#fork-pull-requests) covers those cases, which
refuse `update` too.

The [`update` command](/commands/update) 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.
