dev-master
9999999-devGIT repository for CCABS.
MIT
The Requires
The Development Requires
GIT repository for CCABS.
This is a lightweight git adapter, providing the git commands in PHP., (*2)
The API use command builders, that allow you to build a command and execute it one time., (*3)
The main synopsis is:, (*4)
$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., (*5)
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., (*6)
use ContaoCommunityAlliance\BuildSystem\Repository\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., (*7)
use ContaoCommunityAlliance\BuildSystem\Repository\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:contao-community-alliance/build-system-repository-git.git') ->execute();
$git->remote() ->setPushUrl('origin', 'git@github.com:contao-community-alliance/build-system-repository-git.git') ->execute();
$git->remote() ->add('github', 'git@github.com:contao-community-alliance/build-system-repository-git.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();
$git->tag()->execute('v1.2.3');
$remotes = $git->remote()->getNames(); // array( // 'origin', // 'composer', // )
$remotes = $git->branch()->getNames(); // array( // 'master', // 'hotfix/1.2.3', // )
$remotes = $git->branch()->remotes()->->getNames(); // array( // 'origin/master', // 'origin/hotfix/1.2.3', // 'origin/release/4.5.6', // )
$remotes = $git->branch()->all()->->getNames(); // array( // 'master', // 'hotfix/1.2.3', // 'remotes/origin/master', // 'remotes/origin/hotfix/1.2.3', // 'remotes/origin/release/4.5.6', // )
$status = $git->status()->getStatus(); // array( // 'existing-file.txt' => array('index' => 'D', 'worktree' => false), // 'removed-but-staged.txt' => array('index' => 'D', 'worktree' => 'A'), // 'staged-file.txt' => array('index' => false, 'worktree' => 'A'), // 'unknown-file.txt' => array('index' => '?', 'worktree' => '?'), // )
$status = $git->status()->getIndexStatus(); // array( // 'existing-file.txt' => 'D', // 'removed-but-staged.txt' => 'D', // 'staged-file.txt' => false, // 'unknown-file.txt' => '?', // )
$status = $git->status()->getWorkTreeStatus(); // array( // 'existing-file.txt' => 'worktree' => false, // 'removed-but-staged.txt' => 'worktree' => 'A', // 'staged-file.txt' => 'worktree' => 'A', // 'unknown-file.txt' => 'worktree' => '?', // )
GIT repository for CCABS.
MIT