public static function findGitRepository($directory)
    {
        $process = new Process('git rev-parse --show-toplevel', $directory);
        $process->run();

        if (!$process->isSuccessful()) {
            return false;
        }

        $rootPath = trim($process->getOutput());
        return new Git($rootPath);
    }