private function findGitVersion(string $projectDir): ?string
    {
        $branch = static::revParse('--abbrev-ref HEAD', $projectDir);

        if (empty($branch)) {
            return null;
        }

        return $branch . ' ' . static::revParse('--short HEAD', $projectDir);
    }
private function findGitVersion(string $projectDir): ?string
    {
        $branch = static::revParse('--abbrev-ref HEAD', $projectDir);

        if (empty($branch)) {
            return null;
        }

        return $branch . ' ' . static::revParse('--short HEAD', $projectDir);
    }
private function findGitVersion ( string $ projectDir ) : ? string { $ branch = static :: revParse ( '--abbrev-ref HEAD' , $ projectDir ) ; if ( empty ( $ branch ) ) { return null ; } return $ branch . ' ' . static :: revParse ( '--short HEAD' , $ projectDir ) ; }
Returns the current git branch name and revision or null if git repo cannot be found.

@param string $projectDir

@return string|null
Returns the current git branch name and revision or null if git repo cannot be found .