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.
Requirements
Section titled RequirementsWhatever your configuration says, Mergify adds one requirement before it copies:
the pull request has to be free of conflict with its base branch. It does not
have to be merged, so copy runs on an open pull request as well as a merged
one. The same requirement applies to the copy
action.
When the pull request is in conflict, the command answers that there is nothing
to do and stops there. Unlike backport, which waits for
the pull request to be merged, copy does not wait for the requirement to be
met, so resolve the conflict and run it again.
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!