PHP wrapper for Git commands
You can install the package via composer:
composer require ghostwriter/gitYou can also star (🌟) this repo to find it easier later.
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();Please see CHANGELOG.md for more information on what has changed recently.
Please see LICENSE for more information on the license that applies to this project.
Please see SECURITY.md for more information on security disclosure process.