2017 © Pedro Peláez
 

library git

Git abstraction

image

innmind/git

Git abstraction

  • Tuesday, November 14, 2017
  • by Baptouuuu
  • Repository
  • 1 Watchers
  • 13 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Git

Build Status codecov Type Coverage, (*1)

Abstraction layer to manipulate local git repositories., (*2)

Feel free to submit a PR to add other git functionalities., (*3)

Installation

composer require innmind/git

Usage

use Innmind\Git\{
    Git,
    Repository\Remote\Name,
    Repository\Remote\Url,
    Revision\Branch,
};
use Innmind\OperatingSystem\Factory;
use Innmind\Url\Path;

$os = Factory::build();
$git = Git::of($os->control(), $os->clock());
$repository = $git
    ->repository(Path::of('/somewhere/on/the/local/machine'))
    ->unwrap();
$_ = $repository
    ->init()
    ->unwrap();
$remotes = $repository->remotes();
$remotes
    ->add(Name::of('origin'), Url::of('git@github.com:Vendor/Repo.git'))
    ->unwrap();
$remotes
    ->get(Name::of('origin'))
    ->push(Branch::of('master'))
    ->unwrap();
$repository
    ->branches()
    ->new(Branch::of('develop'))
    ->unwrap();
$repository
    ->checkout()
    ->revision(Branch::of('develop'))
    ->unwrap();

This example initialize a local git repository, declare a github repository as its remote and finally checkout the new branch develop., (*4)

The offered functionalities goes beyond this single example, check the classes' api to discover all of them., (*5)

The Versions