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;
    }
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;
    }
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 ; }
Commit content to the repository, eventually staging all unstaged content

@param string        $message    the commit message
@param bool          $stageAll   whether to stage on not everything before commit
@param string|null   $ref        the reference to commit to (checkout -> commit -> checkout previous)
@param string|Author $author     override the author for this commit
@param bool          $allowEmpty override the author for this commit

@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository
Commit content to the repository eventually staging all unstaged content