pj95wg
Last Updated: February 25, 2016
·
1.341K
· dotcode
0abba8c023667a16e939e2d6ada9eb5a

Simplify resolving Mercurial conflicts

If you frequently find yourself resolving conflicts in Mercurial, stick this in your startup script of choice, it can speed things up a bit:

conflictedFiles="find . -name '*.orig' | sed 's/\.orig//g'"

# open conflicted files in text editor of choice - e.g. SublimeText
alias o="$conflictedFiles | xargs subl"

# do work, then:
# mark conflicted files as resolved
alias r="$conflictedFiles | xargs -I {} hg resolve -m {}"

# delete original files
alias d="find . -name '*.orig' | xargs rm"

Usage: type "o", do work to resolve conflicts, type "r", then "d" (open, resolve, delete).