dev-master
9999999-devAn OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database.
MIT
The Development Requires
by Paul James
An OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database.
An OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database., (*1)
Talks directly to a Git repo via the Git binary, does not require a working copy or writing files to disk so it also works with a bare repo., (*2)
Install via Composer, add a dependency on peej/git
to your project's composer.json
file., (*3)
{ "require": { "peej/git": "1.0.*" } }
A system with git installed, it is expected to be in the command path., (*4)
$repo = new Git\Repo('/tmp/myrepo.git'); // get head commit message echo $repo->commit()->message; // get a file from the head echo $repo->file('mydir/myfile.txt'); // get the latest commit the file was mentioned in $commit = $repo->file('mydir/myfile.txt')->history[0]; // get a tree for a given path $tree = $repo->tree('mydir'); echo $tree['myfile.txt']; // stage a file edit $repo->update('mydir/myfile.txt', 'new content'); // create a new commit $repo->save('commit message');
An OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database.
MIT