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

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

Create a new branch and check it out.
public checkOutNew ( string $name, string | null $parent = null, string | null $upstream = null, string | null $dir = null, boolean $mustRun = false ) : boolean
$name string
$parent string | null
$upstream string | null
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
Результат boolean
    public function checkOutNew($name, $parent = null, $upstream = null, $dir = null, $mustRun = false)
    {
        $args = ['checkout', '-b', $name];
        if ($parent !== null) {
            $args[] = $parent;
        } elseif ($upstream !== null) {
            $args[] = '--track';
            $args[] = $upstream;
        }
        return (bool) $this->execute($args, $dir, $mustRun, false);
    }

Usage Example

Пример #1
0
 /**
  * Test GitHelper::getMergedBranches().
  */
 public function testGetMergedBranches()
 {
     $this->gitHelper->checkOutNew('branch1');
     $this->gitHelper->checkOutNew('branch2');
     $this->assertEquals(['branch1', 'branch2', 'master'], $this->gitHelper->getMergedBranches('master'));
 }
All Usage Examples Of Platformsh\Cli\Helper\GitHelper::checkOutNew