def get_scm():
  """Returns the pants Scm if any.

  :API: public
  """
  # TODO(John Sirois): Extract a module/class to carry the bootstrap logic.
  global _SCM
  if not _SCM:
    from pants.scm.git import Git
    # We know about git, so attempt an auto-configure
    worktree = Git.detect_worktree()
    if worktree and os.path.isdir(worktree):
      git = Git(worktree=worktree)
      try:
        logger.debug('Detected git repository at {} on branch {}'.format(worktree, git.branch_name))
        set_scm(git)
      except git.LocalException as e:
        logger.info('Failed to load git repository at {}: {}'.format(worktree, e))
  return _SCM
Returns the pants Scm if any.

  :API: public