Skip to content

Latest commit

 

History

History
112 lines (63 loc) · 1.49 KB

git_stash_command.md

File metadata and controls

112 lines (63 loc) · 1.49 KB

Git Stash

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


Create Instance

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

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

Features:

* Git stash changes

Method Signature:

public function stash(?string $message = null): bool;

Equals Git Command:

git stash

git stash save $message

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->stashes()->stash('message-test');

* Git stash pop

Method Signature:

public function pop(): bool;

Equals Git Command:

git stash pop

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->stashes()->pop();

* Get all git stashes

Method Signature:

public function getList(): \Stash[];

Equals Git Command:

git stash --list

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->stashes()->getList();

* Git apply stash

Method Signature:

public function apply(int $id): bool;

Equals Git Command:

git apply stash stash@{$id}

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->stashes()->apply(1);