Mergify Backport Command
Copy a pull request to another branch after merge.
The backport command is especially useful for projects that maintain
multiple branches simultaneously. It 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 your software or need to ensure
that bug fixes are propagated to all active branches.
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.
Syntax
Section titled Syntax@Mergifyio backport <target-branch> [<another-target-branch>] […]Parameters
Section titled Parameters<target-branch>: The name of the branch to which the changes should be backported.
Limitations
Section titled LimitationsMergify cannot backport a pull request that contains a merge commit, such as
when you merge a teammate’s branch into yours. Merges of the base branch into
your pull request (for example, Merge branch 'main') are an exception and
don’t block the backport.
To avoid this, squash-merge or rebase your pull request before merging so its history stays linear.
Example
Section titled ExampleSuppose 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-stableUpon 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.
Was this page helpful?
Thanks for your feedback!