

This is a lightweight wrapper, providing the git commands in PHP.
The API use command builders, that allow you to build a command and execute it one time.
The main synopsis is:
$git->command()->option()->execute();$git->command() will create a new command, *->option() will add an option to the command and
*->execute() will finally execute the command.
The naming of commands and options follow the git naming. If you search for documentation of a specific command or option, just look into the git documentation. You will find the command/option there.
use Bit3\GitPhp\GitRepository;
$directory = '/path/to/git/target/directory';
$git = new GitRepository($directory);
$git->init()->execute();The clone command is named cloneRepository() because clone is a reserved word in PHP.
use Bit3\GitPhp\GitRepository;
$directory = '/path/to/git/target/directory';
$git = new GitRepository($directory);
$git->cloneRepository()->execute();$annotatedTag = $git->describe()->execute();
$lightweightTag = $git->describe()->tags()->execute();
$recentRef = $git->describe()->all()->execute();$git->remote()
->setUrl('origin', 'git@github.com:bit3/git-php.git')
->execute();$git->remote()
->setPushUrl('origin', 'git@github.com:bit3/git-php.git')
->execute();$git->remote()
->add('github', 'git@github.com:bit3/git-php.git')
->execute();$git->fetch()->execute('github');$git->checkout()->execute('hotfix/1.2.3');$git->checkout()->execute('hotfix/1.2.3', '/fileA', '/fileB', '/dir/fileC');$git->push()->execute('github', 'hotfix/1.2.3');$git->add()->execute('file/to/add.ext');$git->rm()->execute('file/to/remove.ext');$git->commit()->message('Commit message')->execute();