PHP wrapper for Git commands.

Fund package maintenance!
ghostwriter

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/ghostwriter/git


README

GitHub Sponsors Automation Supported PHP Version Downloads

PHP wrapper for Git commands

Installation

You can install the package via composer:

composer require ghostwriter/git

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

use Ghostwriter\Git\Git;

$environmentVariables = [
    'GIT_AUTHOR_NAME'  => 'Nathanael Esayeas',
    'GIT_AUTHOR_EMAIL' => 'nathanael.esayeas@protonmail.com',
];

$git = Git::new('/path/to/repo', $environmentVariables);
$git->init();
$git->add('file.txt');
$git->commit('-m', 'Initial commit');
$git->push('origin', 'main');

// Cloning a repository
$git->clone('git@github.com:ghostwriter/git.git', '--depth=1', '/path/to/clone');

// Each cloned repository should be managed with its own Git instance as follows:
$environmentVariables['GIT_AUTHOR_NAME'] = 'ghostwriter';
$environmentVariables['GIT_AUTHOR_EMAIL'] = 'ghostwriter@users.noreply.github.com';

$clonedGit = Git::new('/path/to/clone', $environmentVariables);
$clonedGit->status();

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.