Search code examples
mercurial

How to checkout a file from one branch to another in Mercurial?


How to checkout a single file from one branch to another in Mercurial?

Basically I want to copy a single file from a branch experimental to another branch production.


Solution

  • You can show any file at any revision with hg cat -r experimental filename. But this kind of behavior looks like a debugging patch, in which case I would consider transplanting (cherry-picking in other DVCS).

    hg revert -r experimental filename could do it, not tested.