Search code examples
mercurial

Resolving conflicts: how to accept "their" changes automatically?


When merging conflicting changes using hg merge, Mercurial inserts a set of markers into the files to be merged in my working copy like this:

<<<<<<< local
  version = 0.2
=======
  version = 0.1
>>>>>>> other

Then I manually edit all files marked as U from a list produced by hg resolve --all -l and then I tell mercurial I have resolved them by hg resolve -m file1 file2 file3 ...

In many situations I would like however accept either my-only or their-only changes on some conflicting files. I am thinking to create two simple sed/awk/whatever scripts named accept-theirs.sh and accept-my.sh or is there any "proper" way to do it?


Solution

  • Use

    hg resolve -t internal:other --all
    

    to accept theirs and

    hg resolve -t internal:local --all
    

    to accept yours