def METHOD_NAME(self, branch, merge=False):
    try:
        self.git_throwing_silently(
            "checkout",
            "--merge" if merge else None,
            branch
        )
    except GitSavvyError as e:
        if DIRTY_WORKTREE_MESSAGE in e.stderr and not merge:
            show_actions_panel(self.window, [
                noop("Abort, local changes would be overwritten by checkout."),
                (
                    "Try a 'checkout --merge'.",
                    partial(self.METHOD_NAME, branch, merge=True)
                )
            ])
            return
        else:
            e.show_error_panel()
            raise
    self.window.status_message("Checked out `{}`.".format(branch))
    util.view.refresh_gitsavvy_interfaces(self.window, refresh_sidebar=True)