Search code examples
mercurialtortoisehg

How to merge one directory in Mercurial?


I want to merge one directory from branch 'default' to 'A'. Currently I do merge and then revert all other directories. That's quite a lot of files.

Is there simpler way to do this?


Solution

  • Mercurial looks at the entire repository as being a 'unit'. As such, it's not possible to only merge a part of the repository. That wouldn't make sense, as you could then have a part of your repository on branch A and another part on branch B.

    If that single directory can be considered a separate 'unit' from the rest of the repository, you could make it a subrepository. That way, you can merge the subrepository (which doesn't require merging the top-level repository).

    However, keep in mind: subrepositories add complexity!