PHP code example of chrishalbert / git

1. Go to this page and download the library: Download chrishalbert/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/ */

    

chrishalbert / git example snippets


$git = new Git();
$branches = $git->branch();

// Fix a file for all branches
foreach ($branches as $branch) {
    $git->checkout($branch);
    // Do stuff
    $git->add('.');
    $git->commit(['--message' => 'Fixed a bug']);
}

$git->checkout('master');