Mergify Backport Command

Copy a pull request to another branch after merge.


The backport command is one of Mergify’s most useful features, especially for projects that maintain multiple branches simultaneously. This command automates the process of creating a new pull request to apply changes from a merged pull request onto another branch. Whether you’re maintaining different versions of a software or need to ensure that bug fixes are propagated to all active branches, backport has got you covered.

With the backport command, managing changes across multiple branches becomes a breeze. Say goodbye to the tedious manual cherry-picking and let Mergify streamline your workflow.

Once the backport is initiated, Mergify will provide feedback directly in the comments. If the backport is successful, you’ll receive a link to the newly created pull request. If there are issues, Mergify will provide a brief description of the problem.

If Mergify encounters merge conflicts during the backport process, it will create a pull request with the conflicts. You’ll need to manually resolve these conflicts within GitHub.

The backport command is especially handy for:

  • Version Maintenance: Quickly propagate bug fixes to older, maintained versions of your software.

  • Feature Parity: Ensure that features developed on a mainline branch are also available on other active branches.

@Mergifyio backport <target-branch> [<another-target-branch>] […]
  • <target-branch>: The name of the branch to which the changes should be backported.

Suppose you have a pull request that was merged into main, but you also want to apply these changes to a branch named v2.0-stable. You would use the command as follows:

@Mergifyio backport v2.0-stable

Upon executing this command, Mergify will attempt to automatically create a new pull request with the changes onto the v2.0-stable branch as soon as the original pull request is merged.