Platformsh\Cli\Helper\GitHelper::getCurrentBranch PHP Метод

getCurrentBranch() публичный Метод

Get the current branch name.
public getCurrentBranch ( string $dir = null, boolean $mustRun = false ) : string | false
$dir string The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат string | false
    public function getCurrentBranch($dir = null, $mustRun = false)
    {
        $args = ['symbolic-ref', '--short', 'HEAD'];
        return $this->execute($args, $dir, $mustRun);
    }

Usage Example

Пример #1
0
 /**
  * Test GitHelper::getCurrentBranch().
  */
 public function testGetCurrentBranch()
 {
     $this->gitHelper->checkOutNew('test');
     $this->assertEquals('test', $this->gitHelper->getCurrentBranch());
 }
All Usage Examples Of Platformsh\Cli\Helper\GitHelper::getCurrentBranch