Platformsh\Cli\Helper\GitHelper::setUpstream PHP Method

setUpstream() public method

Set the upstream for the current branch.
public setUpstream ( string | false $upstream, string | null $dir = null, boolean $mustRun = false ) : boolean
$upstream string | false The upstream name, or false to unset the upstream.
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
return boolean
    public function setUpstream($upstream, $dir = null, $mustRun = false)
    {
        $args = ['branch'];
        if ($upstream !== false) {
            $args[] = '--set-upstream-to=' . $upstream;
        } else {
            $args[] = '--unset-upstream';
        }
        return (bool) $this->execute($args, $dir, $mustRun);
    }