When you encounter a merge conflict with Mercurial, things can get a little disorienting. The following is a practical list of steps to handle a merge conflict without getting lost.
- List the conflict status (U = Unresolved, R = Resolved):
hg resolve -la
- Check the parents (first parent = local, second parent = other):
hg parents
- Resolve the conflict:
- Manual resolution and mark as resolved:
vim <file> hg resolve -m <file>
- Resolution using a tool (such as fmmerge):
hg resolve -t fmmerge <file>
- Resolve by selecting local/other version:
hg resolve -t internal:local <file> hg resolve -t internal:other <file>
- Manual resolution and mark as resolved:
- (If the resolution went wrong) Marking a file as unresolved, to redo the merge:
hg resolve -u <file>
- (If you decide the merge was a bad idea) To abort the merge altogether:
hg update -C <rev>
Pingback: Handling merge conflicts with git | Keep It With Mine