code: def publish(scm, to_branch, verbose, fake):
      
      scm.fake = fake
      scm.verbose = fake or verbose
  
      scm.repo_check(require_remote=True)
      branch = scm.fuzzy_match_branch(to_branch)
  
      if not branch:
          branch = scm.get_current_branch_name()
          scm.display_available_branches()
          if to_branch is None:
              click.echo("Using current branch {0}".format(crayons.yellow(branch)))
          else:
              click.echo(
                  "Branch {0} not found, using current branch {1}"
                  .format(crayons.red(to_branch), crayons.yellow(branch)))
  
      branch_names = scm.get_branch_names(local=False)
  
      if branch in branch_names:
          raise click.BadArgumentUsage(
              "Branch {0} is already published. Use a branch that is not published."
              .format(crayons.yellow(branch)))
  
      status_log(scm.publish_branch, 'Publishing {0}.'.format(
          crayons.yellow(branch)), branch)
docs: Pushes an unpublished branch to a remote repository.