Skip to content
generated from ghostwriter/wip

ghostwriter/git

Git

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.

About

PHP wrapper for Git commands.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors

Languages