code: def checkout(branch, quiet=False, as_path=False):
      
      try:
          if as_path:
              branch = '-- %s' % branch
          run('checkout %s %s' % (quiet and '-q' or '', branch))
          return True
      except GitError as e:
          if 'need to resolve your current index' in e.output:
              raise
          return False
docs: Check out that branch
  
      Defaults to a quiet checkout, giving no stdout
          if stdout it wanted, call with quiet = False
  
      Defaults to checking out branches
          If as_path is true, then treat "branch" like a file, i.e.
          $ git checkout -- branch
  
      All errors will pass silently, just returning False
          except any messages about "you need to resolve your current index"
          These indicate that the repository is not in a normal state
              and action by a user is usually needed to resolve that
          So the exception is allowed to rise
              probably stopping the script