public function isAhead(): bool
    {
        if (! $this->isTracking()) {
            throw new GitException('Error: HEAD does not have a remote tracking branch. Cannot check if it is ahead.');
        }

        $mergeBase = $this->run('merge-base', ['@', '@{u}']);
        $localSha = $this->run('rev-parse', ['@']);
        $remoteSha = $this->run('rev-parse', ['@{u}']);
        return $mergeBase === $remoteSha && $localSha !== $remoteSha;
    }
public function isAhead(): bool
    {
        if (! $this->isTracking()) {
            throw new GitException('Error: HEAD does not have a remote tracking branch. Cannot check if it is ahead.');
        }

        $mergeBase = $this->run('merge-base', ['@', '@{u}']);
        $localSha = $this->run('rev-parse', ['@']);
        $remoteSha = $this->run('rev-parse', ['@{u}']);
        return $mergeBase === $remoteSha && $localSha !== $remoteSha;
    }
public function isAhead ( ) : bool { if ( ! $ this -> isTracking ( ) ) { throw new GitException ( 'Error: HEAD does not have a remote tracking branch. Cannot check if it is ahead.' ) ; } $ mergeBase = $ this -> run ( 'merge-base' , [ '@' , '@{u}' ] ) ; $ localSha = $ this -> run ( 'rev-parse' , [ '@' ] ) ; $ remoteSha = $ this -> run ( 'rev-parse' , [ '@{u}' ] ) ; return $ mergeBase === $ remoteSha && $ localSha !== $ remoteSha ; }
Returns whether HEAD is ahead of its remote tracking branch.

If this returns true it means that commits are present locally which have
not yet been pushed to the remote.
Returns whether HEAD is ahead of its remote tracking branch .