PHP code example of michaelpetri / php-git

1. Go to this page and download the library: Download michaelpetri/php-git library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

michaelpetri / php-git example snippets


$file = File::from('/home/mpetri/PhpstormProjects/php-git/README.md');

$repository = new GitRepository(
    $file->directory,
    Directory::from('/home/mpetri/PhpstormProjects/php-git/.git'),
    Duration::inSeconds(60)
);

$repository->add($file);
$repository->commit('Initial commit')
shell
composer