Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mercurial

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?

like image 891
Sylvain Avatar asked Mar 09 '10 18:03

Sylvain


2 Answers

You could clone your repository to your latest checkin, merge the changes with the clone, commit, and then pull the new changeset from your cloned repository back into your current one.

like image 33
Nate Heinrich Avatar answered Sep 28 '22 00:09

Nate Heinrich


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

like image 86
Macke Avatar answered Sep 28 '22 00:09

Macke