2017 © Pedro Peláez
 

library git

An OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database.

image

peej/git

An OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database.

  • Sunday, May 3, 2015
  • by Peej
  • Repository
  • 5 Watchers
  • 11 Stars
  • 257 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Git

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)

Installation

Install via Composer, add a dependency on peej/git to your project's composer.json file., (*3)

{
    "require": {
        "peej/git": "1.0.*"
    }
}

Requirements

A system with git installed, it is expected to be in the command path., (*4)

Usage

$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');

The Versions

03/05 2015

dev-master

9999999-dev

An OO wrapper for Git allowing use of a Git repo as if it were a filesystem or database.

  Sources   Download

MIT

The Development Requires

by Paul James