src/Composer/Util/Git.php
public function getVersion()
    {
        if (isset(self::$version)) {
            return self::$version;
        }
        if (0 !== $this->process->execute('git --version', $output)) {
            return;
        }
        if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
            return self::$version = $matches[1];
        }
    }
public function getVersion()
    {
        if (isset(self::$version)) {
            return self::$version;
        }
        if (0 !== $this->process->execute('git --version', $output)) {
            return;
        }
        if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
            return self::$version = $matches[1];
        }
    }
Retrieves the current git version.

@return string|null The git version number.