branch() public method

List, create, or delete branches.
public branch ( ) : GitWorkingCopy
return GitWorkingCopy
Esempio n. 1
0
 /**
  * Fetches the branches via the `git branch` command.
  *
  * @param boolean $onlyRemote
  *   Whether to fetch only remote branches, defaults to false which returns
  *   all branches.
  *
  * @return array
  */
 public function fetchBranches($onlyRemote = false)
 {
     $this->git->clearOutput();
     $options = $onlyRemote ? array('r' => true) : array('a' => true);
     $output = (string) $this->git->branch($options);
     $branches = preg_split("/\r\n|\n|\r/", rtrim($output));
     return array_map(array($this, 'trimBranch'), $branches);
 }