Skip to content

Latest commit

 

History

History
70 lines (40 loc) · 1.21 KB

git_commit_command.md

File metadata and controls

70 lines (40 loc) · 1.21 KB

Git Commits

Use the interface: ArtARTs36\GitHandler\Contracts\Commands\GitCommitCommand


Create Instance

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

$command = (new LocalGitFactory())->factory(__DIR__)->commits();

Features:

* Execute commit

Method Signature:

See classes:

public function commit(string $message, bool $amend = false, Author $author = null): bool;

Equals Git Command:

git commit -m="{$message}"

git commit -m="{$message}" --amend

git commit -m="{$message}" --author="$author"

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->commits()->commit('message-test', true, 'author-test');

*

Method Signature:

public function autoCommit(string $message, bool $amend = false): bool;

Equals Git Command:

git add (untracked files) && git commit -m $message

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->commits()->autoCommit('message-test', true);