Helpful Mercurial examples


Merge 2 heads

$ hg update -C :changeset_XXX # jump to one head
$ hg merge otherhead # merge in the other head
$ hg revert -a -r :changeset_XXX # undo all the changes from the merge
$ hg commit -m "eliminate other head" # create new tip identical to the old


Create a diff patch

$ hg diff -r :changeset_XXX -r :changeset_YYY > my_patch_file.patch

Apply a diff patch

$ hg import my_patch_file.patch


Revert to a specific commit

$ hg revert --all --rev :changeset_XXX

Revert a specific file to a specific commit

$ hg revert -r :changeset_XXX :filename


$ hg revert :filename

if you want to discard your current changes and get the latest that was committed.


Resolve conflicts tricks

$ hg resolve -t internal:local --all
$ hg resolve -t internal:other --all
$ hg resolve -t internal:other /path/to/file


********************************** ************************* ************************ **************** ****************** *********** ************** ************* ************ *************