Checkout this branch. Create it if necessary, and push it to origin.

def checkout_create_push_branch(repo, name):
    """Checkout this branch. Create it if necessary, and push it to origin.
    """
    try:
        repo.git.checkout(name)
        _LOGGER.info("Checkout %s success", name)
    except GitCommandError:
        _LOGGER.info("Checkout %s was impossible (branch does not exist). Creating it and push it.", name)
        checkout_and_create_branch(repo, name)
        repo.git.push('origin', name, set_upstream=True)