This lib is used to execute git
commands via a easy php api.
All you have to do is setup a Repository
object retrieve a command Operator
and fire away. Each git command like git config or git log is handled
by an Operator
. Follow the next steps to give it a try.
Setup the Repository
$repoRootPath = '/var/www/my-project;
$gitRepository = new Git\Respository($repoRootPath);
Retrieve the needed Operator
$log = $repo->getLogOperator();
Get files and commits since some tag
$files = $log->getChangedFilesSince('1.0.0');
$commits = $log->getCommitsSince('1.0.0');
use SebastianFeldmann\Git;
$repoRootPath = '/path/to/repo';
$gitRepository = new Git\Respository($repoRootPath);
// get files and commits since hash or tag
$log = $repo->getLogOperator();
$files = $log->getChangedFilesSince('1.0.0');
$commits = $log->getCommitsSince('1.0.0');
// check the index status
$index = $repo->getIndexOperator();
$files = $index->getStagedFiles();
##Example commands
Get the current tag.
git descibe --tag
Get a list of staged files.
git diff-index --cached --name-status HEAD
Get all current git settings.
git config --list
Get all changes files since a given commit ot tag
git log --format='' --name-only $HASH