Methods summary
public
|
|
public
string
|
|
public
Cz\Git\GitRepository
|
#
createTag( string $name, array|null $options = NULL )
Creates a tag.
git tag <name>
Creates a tag.
git tag <name>
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
removeTag( string $name )
Removes tag.
git tag -d <name>
Removes tag.
git tag -d <name>
Parameters
Returns
Throws
Implementation of
|
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
Returns
Throws
Implementation of
|
public
string[]|null
|
#
getTags( )
Returns list of tags in repo.
Returns list of tags in repo.
Returns
string[]|null NULL => no tags
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
merge( string $branch, array|null $options = NULL )
Merges branches.
git merge <options> <name>
Merges branches.
git merge <options> <name>
Parameters
Returns
Throws
Implementation of
|
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
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
removeBranch( string $name )
Removes branch.
git branch -d <name>
Removes branch.
git branch -d <name>
Parameters
Returns
Throws
Implementation of
|
public
string
|
#
getCurrentBranchName( )
Gets name of current branch
git branch + magic
Gets name of current branch
git branch + magic
Returns
string
Throws
Implementation of
|
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
Throws
Implementation of
|
public
string[]|null
|
#
getRemoteBranches( )
Returns list of remote branches in repo.
Returns list of remote branches in repo.
Returns
string[]|null NULL => no branches
Throws
|
public
string[]|null
|
#
getLocalBranches( )
Returns list of local branches in repo.
Returns list of local branches in repo.
Returns
string[]|null NULL => no branches
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
checkout( string $name )
Checkout branch.
git checkout <branch>
Checkout branch.
git checkout <branch>
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
removeFile( string|string[] $file )
Removes file(s).
git rm <file>
Removes file(s).
git rm <file>
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
addFile( string|string[] $file )
Adds file(s).
git add <file>
Adds file(s).
git add <file>
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
addAllChanges( )
Adds all created, modified & removed files.
git add --all
Adds all created, modified & removed files.
git add --all
Returns
Throws
Implementation of
|
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
Throws
Implementation of
|
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
Throws
Implementation of
|
public
string|null
|
#
getLastCommitId( )
Returns last commit ID on current branch
git log --pretty=format:"%H" -n 1
Returns last commit ID on current branch
git log --pretty=format:"%H" -n 1
Returns
string|null
Throws
|
public
boolean
|
#
hasChanges( )
Exists changes?
git status + magic
Exists changes?
git status + magic
Returns
boolean
Throws
Implementation of
|
public
|
|
public
Cz\Git\GitRepository
|
#
pull( string|null $remote = NULL, array $params = NULL )
Pull changes from a remote
Pull changes from a remote
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
push( string|null $remote = NULL, array $params = NULL )
Push changes to a remote
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
fetch( string|null $remote = NULL, array $params = NULL )
Run fetch command to get latest branches
Run fetch command to get latest branches
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
addRemote( string $name, string $url, array $params = NULL )
Adds new remote repository
Adds new remote repository
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
renameRemote( string $oldName, string $newName )
Renames remote repository
Renames remote repository
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
removeRemote( string $name )
Removes remote repository
Removes remote repository
Parameters
Returns
Throws
Implementation of
|
public
Cz\Git\GitRepository
|
#
setRemoteUrl( string $name, string $url, array $params = NULL )
Changes remote repository URL
Changes remote repository URL
Parameters
Returns
Throws
Implementation of
|
public
string[]
|
#
execute( string|string[] $cmd )
Parameters
Returns
string[] returns output
Throws
|
protected
Cz\Git\GitRepository
|
|
protected
Cz\Git\GitRepository
|
|
protected
string[]|null
|
#
extractFromCommand( string $cmd, callable|null $filter = NULL )
Parameters
Returns
string[]|null
Throws
|
protected
Cz\Git\GitRepository
|
#
run( string|array $cmd )
Runs command.
Parameters
Returns
Throws
|
protected static
|
|
public static
Cz\Git\GitRepository
|
#
init( string $directory, array $params = NULL )
Init repo in directory
Parameters
Returns
Throws
Implementation of
|
public static
Cz\Git\GitRepository
|
#
cloneRepository( string $url, string|null $directory = NULL, array $params = NULL )
Clones GIT repository from $url into $directory
Clones GIT repository from $url into $directory
Parameters
Returns
Throws
Implementation of
|
public static
boolean
|
|
public static
boolean
|
#
isAbsolute( $path )
Is path absolute?
Method from Nette\Utils\FileSystem
Is path absolute?
Method from Nette\Utils\FileSystem
Returns
boolean
Link
|
public
string
|
#
getCommitMessage( string $commit, boolean $oneline = FALSE )
Returns commit message from specific commit
git log -1 --format={%s|%B} )--pretty=format:'%H' -n 1
Returns commit message from specific commit
git log -1 --format={%s|%B} )--pretty=format:'%H' -n 1
Parameters
- $commit
- ID
- $oneline
- %s instead of %B if TRUE
Returns
string
Throws
|
public
array
|
#
getCommitData( string $commit )
Returns array of commit metadata from specific commit
git show --raw <sha1>
Returns array of commit metadata from specific commit
git show --raw <sha1>
Parameters
Returns
array
Throws
|