GitWrapper\GitWorkingCopy::commit PHP Method

commit() public method

Record changes to the repository. If only one argument is passed, it is assumed to be the commit message. Therefore $git->commit('Message'); yields a git commit -am "Message" command.
public commit ( ) : GitWorkingCopy
return GitWorkingCopy
    public function commit()
    {
        $args = func_get_args();
        if (isset($args[0]) && is_string($args[0]) && !isset($args[1])) {
            $args[0] = array('m' => $args[0], 'a' => true);
        }
        array_unshift($args, 'commit');
        return $this->run($args);
    }

Usage Example

Example #1
0
 public function execute(GitWorkingCopy $git, LocalPackage $package)
 {
     $git->add('.');
     $this->dispatchEvent(StepsEvents::GIT_ADDED, new GitEventMade($git));
     $git->commit($this->getCommitMessage($git));
     $this->dispatchEvent(StepsEvents::GIT_COMMITTED, new GitEventMade($git));
     $git->push('origin', $package->getLocalBranch(), array('f' => true));
     $this->dispatchEvent(StepsEvents::GIT_PUSHED, new GitEventMade($git));
     return null === $git->getStatus() ? true : false;
 }
All Usage Examples Of GitWrapper\GitWorkingCopy::commit