Mergify Copy Command
Copy a pull request to another branch.
The copy command replicates changes from a pull request to another branch
within the same repository. This is particularly useful for teams working with
multiple branches, such as feature branches, and wanting to propagate changes
without manually creating multiple pull requests.
The copy command can simplify your branching strategy and development flow
by quickly mirroring changes where needed.
After initiating the copy process, Mergify will provide feedback via comments. If the copy is successful, a link to the new pull request will be provided. In case of issues, Mergify will provide a concise description of the problem.
If Mergify encounters merge conflicts during the copying process, it will create a pull request with the unresolved conflicts. These will need to be resolved manually on GitHub.
The copy command is especially handy for:
-
Feature Propagation: When a change made in one branch, such as a feature branch, needs to be mirrored in another branch, like a development or staging branch.
-
Hotfixes and Quick Patches: When a quick fix made in one branch needs to be propagated to multiple other branches.
Syntax
Section titled Syntax@Mergifyio copy <target-branch> [<another-target-branch>] […]Parameters
Section titled Parameters<target-branch>: The destination branch within the same repository.
Limitations
Section titled LimitationsMergify cannot copy 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 copy.
To avoid this, rebase your pull request or squash its commits so its history stays linear.
Example
Section titled ExampleAssume you have made changes in a pull request targeting the feature-x branch
and you want to copy these changes to the development branch:
@Mergifyio copy developmentMergify will then try to create a new pull request in the development branch
with the changes from the current pull request.
Was this page helpful?
Thanks for your feedback!