BitBucket + hg + branch merges

Ever have to update/merge a PR on BitBucket with Mercurial? I couldn’t find documentation anywhere, so doing so here:

  1. hg up BOOKMARK_NAME
  2. hg merge [–preview] -r REV
  3. If EDITOR is not set:
    export EDITOR=vim
  4. hg resolve –all
  5. hg commit -m “Merge with default”
  6. hg push –allow-anon

GitHub + Rebasing from upstream/master to origin/master

So, every now and then on a PR I need to rebase and fix things so I can retest etc. – I always forget this so blogging it to remember.


I have a diff on origin/master on my forked repo and I need a rebase from upstream/master (where I forked from).

Github recommends merging (, this is not always the best way. I do the following:

  1. git remote add upstream
  2. git fetch upstream master
  3. git rebase upstream/master (no space here ‘/’ instead)

I hope this saves you some time as I continually waste time here.