EXPERIMENTAL: do a merge before a checkout.

Trying to handle the cases where a branch is checked out and
updated. We need to merge before we can set references. This may
not work as desired, though, in cases where we checkout a different
branch, since the merge happens before the checkout.