Search code examples
mercurial

How to 'hg merge' without affecting the working directory?


Suppose that:

  • I have a repo called MyRepo.
  • I have uncommitted changes in my working directory.
  • I do a pull from Repo1 and that creates a branch in MyRepo
  • I want to do a merge of what I already had in my repo with what I have just pulled.

As described here, the merge process changes the state of the working directory.

In my scenario, I don't want to loose the uncommitted changes that are in my working directory because at that point, I'm interested in changing the state of MyRepo; not the state of my working directory.

Is there a way to go through the merging process, including resolving conflicts manually, without affecting the content my working directory? Can this process be done in temporary files only? Or should I shelve my changes, do the merge and then unshelve to restore my working dir to the state it was before the merge?


Solution

  • Use shelve or attic extensions to temporarily stash your changes while you merge.