public function commit(string $message, $stageAll = false, $ref = null, $author = null, $allowEmpty = false)
    {
        $currentBranch = null;
        if (!is_null($ref)) {
            $currentBranch = $this->getMainBranch();
            $this->checkout($ref);
        }
        if ($stageAll) {
            $this->stage();
        }
        $this->caller->execute(MainCommand::getInstance($this)->commit($message, $stageAll, $author, $allowEmpty));
        if (!is_null($ref)) {
            $this->checkout($currentBranch);
        }

        return $this;
    }