Skip to content

Latest commit

 

History

History
114 lines (64 loc) · 1.81 KB

git_config_command.md

File metadata and controls

114 lines (64 loc) · 1.81 KB

Git Config (set, get list, ...)

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


Create Instance

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

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

Features:

* Get config list

Method Signature:

public function getAll(): ArtARTs36\GitHandler\Config\Subjects\SubjectsCollection;

Equals Git Command:

git config --list

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->config()->getAll();

* Get config subject

Method Signature:

public function getSubject(string $prefix): ArtARTs36\GitHandler\Contracts\Config\ConfigSubject;

Equals Git Command:

git config --list

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->config()->getSubject('user');

* Set git config

Method Signature:

public function set(string $scope, string $field, string $value, bool $replaceAll = false): bool;

Equals Git Command:

git config $scope.$field=$value

git config $scope.$field=$value --replace-all

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->config()->set('user', 'name', 'ArtARTs36');

* Unset git config

Method Signature:

public function unset(string $scope, string $field): void;

Equals Git Command:

git config --unset $scope.$field

git config --unset $scope.$field

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->config()->unset('user', 'name');