Overview

Namespaces

  • Cz
    • Git

Classes

  • GitRepository

Interfaces

  • IGit

Exceptions

  • GitException
  • Overview
  • Namespace
  • Class

Class GitRepository

Cz\Git\GitRepository implements Cz\Git\IGit
Namespace: Cz\Git
Located at GitRepository.php
Methods summary
public
# __construct( string $repository )

Parameters

$repository
public string
# getRepositoryPath( )

Returns

string
public Cz\Git\GitRepository
# createTag( string $name )

Creates a tag. git tag <name>

Creates a tag. git tag <name>

Parameters

$name

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::createTag()
public Cz\Git\GitRepository
# removeTag( string $name )

Removes tag. git tag -d <name>

Removes tag. git tag -d <name>

Parameters

$name

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::removeTag()
public Cz\Git\GitRepository
# renameTag( string $oldName, string $newName )

Renames tag. git tag <new> <old> git tag -d <old>

Renames tag. git tag <new> <old> git tag -d <old>

Parameters

$oldName
$newName

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::renameTag()
public string[]|null
# getTags( )

Returns list of tags in repo.

Returns list of tags in repo.

Returns

string[]|null
NULL => no tags

Implementation of

Cz\Git\IGit::getTags()
public Cz\Git\GitRepository
# merge( string $branch, array|null $options = NULL )

Merges branches. git merge <options> <name>

Merges branches. git merge <options> <name>

Parameters

$branch
$options

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::merge()
public Cz\Git\GitRepository
# createBranch( string $name, boolean $checkout = FALSE )

Creates new branch. git branch <name> (optionaly) git checkout <name>

Creates new branch. git branch <name> (optionaly) git checkout <name>

Parameters

$name
$checkout

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::createBranch()
public Cz\Git\GitRepository
# removeBranch( string $name )

Removes branch. git branch -d <name>

Removes branch. git branch -d <name>

Parameters

$name

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::removeBranch()
public string
# getCurrentBranchName( )

Gets name of current branch git branch + magic

Gets name of current branch git branch + magic

Returns

string

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::getCurrentBranchName()
public string[]|null
# getBranches( )

Returns list of all (local & remote) branches in repo.

Returns list of all (local & remote) branches in repo.

Returns

string[]|null
NULL => no branches

Implementation of

Cz\Git\IGit::getBranches()
public string[]|null
# getLocalBranches( )

Returns list of local branches in repo.

Returns list of local branches in repo.

Returns

string[]|null
NULL => no branches

Implementation of

Cz\Git\IGit::getLocalBranches()
public Cz\Git\GitRepository
# checkout( string $name )

Checkout branch. git checkout <branch>

Checkout branch. git checkout <branch>

Parameters

$name

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::checkout()
public Cz\Git\GitRepository
# removeFile( string|string[] $file )

Removes file(s). git rm <file>

Removes file(s). git rm <file>

Parameters

$file

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::removeFile()
public Cz\Git\GitRepository
# addFile( string|string[] $file )

Adds file(s). git add <file>

Adds file(s). git add <file>

Parameters

$file

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::addFile()
public Cz\Git\GitRepository
# renameFile( string|string[] $file, string|null $to = NULL )

Renames file(s). git mv <file>

Renames file(s). git mv <file>

Parameters

$file
array('from' => 'to', ...) || (from, to)
$to

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::renameFile()
public Cz\Git\GitRepository
# commit( string $message, string[] $params = NULL )

Commits changes git commit <params> -m <message>

Commits changes git commit <params> -m <message>

Parameters

$message
$params
=> value

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::commit()
public boolean
# hasChanges( )

Exists changes? git status + magic

Exists changes? git status + magic

Returns

boolean

Implementation of

Cz\Git\IGit::hasChanges()
public
# isChanges( )

Deprecated

protected Cz\Git\GitRepository
# begin( )

Returns

Cz\Git\GitRepository
protected Cz\Git\GitRepository
# end( )

Returns

Cz\Git\GitRepository
public Cz\Git\GitRepository
# pull( string|null $remote = NULL, array $params = NULL )

Pull changes from a remote

Pull changes from a remote

Parameters

$remote
$params

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::pull()
public Cz\Git\GitRepository
# push( string|null $remote = NULL, array $params = NULL )

Push changes to a remote

Push changes to a remote

Parameters

$remote
$params

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::push()
public
# fetch( $remote = NULL, array $params = NULL )

Run fetch command to get latest branches return self

Run fetch command to get latest branches return self

Implementation of

Cz\Git\IGit::fetch()
protected string[]|null
# extractFromCommand( string $cmd, callable|null $filter = NULL )

Parameters

$cmd
$filter

Returns

string[]|null
protected Cz\Git\GitRepository
# run( string|array $cmd )

Runs command.

Runs command.

Parameters

$cmd

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException
protected static
# processCommand( array $args )
public static Cz\Git\GitRepository
# init( string $directory, array $params = NULL )

Init repo in directory

Init repo in directory

Parameters

$directory
$params

Returns

Cz\Git\GitRepository

Throws

Cz\Git\GitException

Implementation of

Cz\Git\IGit::init()
public static Cz\Git\GitRepository
# cloneRepository( string $url, string|null $directory = NULL )

Clones GIT repository from $url into $directory

Clones GIT repository from $url into $directory

Parameters

$url
$directory

Returns

Cz\Git\GitRepository

Implementation of

Cz\Git\IGit::cloneRepository()
public static string
# extractRepositoryNameFromUrl( string $url )

Parameters

$url
| host.xz:foo/.git | ...

Returns

string
repo | foo | ...
public static boolean
# isAbsolute( $path )

Is path absolute? Method from Nette\Utils\FileSystem

Is path absolute? Method from Nette\Utils\FileSystem

Returns

boolean

Link

https://github.com/nette/nette/blob/master/Nette/Utils/FileSystem.php
Properties summary
protected string $repository
#
protected string|null $cwd

@internal

@internal

#
czproject/git-php v3.6.0 API documentation API documentation generated by ApiGen