In Mercurial, you use hg graft
to copy (also sometimes called cherry pick) changesets from one place to another. It is frequently used to backport a bugfix to a maintenance branch when the bugfix was committed on the wrong branch by accident.
You use it like this:
$ hg update correct-branch
$ hg graft your-commit
This will recreate your-commit
as a child of correct-branch
, similarly to importing your-commit
into MQ, popping the patch, updating to correct-branch
and pushing the patch. The advantage of graft is that it will use three-way merges internally to give you much better conflict resolution. It is really the same way that hg rebase
works.