PHP code example of sebastian / git-state
1. Go to this page and download the library: Download sebastian/git-state 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/ */
sebastian / git-state example snippets
use SebastianBergmann\GitState\Builder;
$builder = new Builder;
$state = $builder->build();
if ($state === false) {
// Not a Git repository or no origin remote configured
exit(1);
}
print $state->originUrl() . PHP_EOL;
print $state->branch() . PHP_EOL;
print $state->commit() . PHP_EOL;
if ($state->isClean()) {
print 'Working directory is clean' . PHP_EOL;
} else {
print $state->status() . PHP_EOL;
}