protected function command($command, $repoPath = null)
    {
        if (!$repoPath) {
            $repoPath = $this->repo;
        }

        $command = 'git --git-dir="'.$repoPath.'/.git" --work-tree="'.$repoPath.'" '.$command;

        exec(escapeshellcmd($command), $output, $returnStatus);

        if ($returnStatus != 0) {
            throw new Exception("The following command was attempted but failed:\r\n$command");
        }

        return $output;
    }