code: public function fetchBranches(bool $onlyRemote = false): array
      {
          $options = $onlyRemote ? ['r' => true] : ['a' => true];
          $output = $this->gitWorkingCopy->branch($options);
          $branches = (array) preg_split("/\r\n|\n|\r/", rtrim($output));
          return array_map([$this, 'trimBranch'], $branches);
      }
docs: Fetches the branches via the `git branch` command.
  
  @param bool $onlyRemote Whether to fetch only remote branches, defaults to false which returns all branches.
  
  @return mixed[]