We're using Kiln and Fogbugz; Kiln is supposed to seamlessly allow git and hg to work together. However, we've run into an issue where git branches are treated like bookmarks in mercurial; we didn't catch this in our repo until changes had been pushed, and now the branches are a bit polluted.
I have public changesets in our default branch that should be in a custom branch. I can back them out, but I need to reapply them to the other public branch. I'm worried about rebasing because these are public changes.
What's the best way to handle this situation?
Edit: I thought I might be able to convert the changesets to a patch using mercurial queues, but the changesets aren't mutable since they're public. I also can't do hg strip for similar reasons.
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.