Skip to content

Latest commit

 

History

History
117 lines (70 loc) · 1.73 KB

git_setup_command.md

File metadata and controls

117 lines (70 loc) · 1.73 KB

Git Init

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


Create Instance

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

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

Features:

* Init git repository

Method Signature:

public function init(): bool;

Equals Git Command:

git init

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->setup()->init();

* Check for init repository

Method Signature:

public function isInit(): bool;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->setup()->isInit();

* Git Clone

Method Signature:

public function clone(string $url, ?string $branch = null, ?string $folder = null): bool;

Equals Git Command:

git clone $url

git clone $url -b $branch

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->setup()->clone('url-test', 'master', 'folder-test');

* Delete this repository

Method Signature:

public function delete(): bool;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->setup()->delete();

* Delete local repository and fetch from origin

Method Signature:

public function reinstall(?string $branch = null): void;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->setup()->reinstall('master');