Property | Type | Description | |
---|---|---|---|
$cloned | If the variable is null, the a rudimentary check will be performed to see if the directory looks like it is a working copy. | ||
$directory | string | Path to the directory containing the working copy. | |
$output | string | The output captured by the last run Git commnd(s). | |
$wrapper | GitWrapper\GitWrapper | The GitWrapper object that likely instantiated this class. |
Method | Description | |
---|---|---|
__call ( $method, $args ) | Hackish, allows us to use "clone" as a method name. | |
__construct ( gitwrapper\GitWrapper $wrapper, string $directory ) | Constructs a GitWorkingCopy object. | |
__toString ( ) : string | Gets the output captured by the last run Git commnd(s). | |
add ( string $filepattern, array $options = [] ) : |
Executes a git add command. | |
addRemote ( string $name, string $url, array $options = [] ) : |
Adds a remote to the repository. | |
apply ( ) : |
Executes a git apply command. | |
archive ( ) : |
Executes a git archive command. | |
bisect ( string $sub_command ) : |
Executes a git bisect command. | |
branch ( ) : |
Executes a git branch command. | |
checkout ( ) : |
Executes a git checkout command. | |
checkoutNewBranch ( string $branch, array $options = [] ) | Create a new branch and check it out. | |
clean ( ) : |
Executes a git clean command. | |
clearOutput ( ) : |
Clears the stored output captured by the last run Git command(s). | |
cloneRepository ( string $repository, array $options = [] ) : |
Executes a git clone command. | |
commit ( ) : |
Executes a git commit command. | |
config ( ) : |
Executes a git config command. | |
diff ( ) : |
Executes a git diff command. | |
fetch ( ) : |
Executes a git fetch command. | |
fetchAll ( array $options = [] ) | Fetches all remotes. | |
getBranches ( ) : gitwrapper\GitBranches | Returns a GitBranches object containing information on the repository's branches. | |
getDirectory ( ) : string | Gets the path to the directory containing the working copy. | |
getOutput ( ) : string | Gets the output captured by the last run Git commnd(s). | |
getRemote ( string $name ) : array | Returns the given remote. | |
getRemoteUrl ( string $remote, string $operation = 'fetch' ) : string | Returns the fetch or push URL of a given remote. | |
getRemotes ( ) : array | Returns all existing remotes. | |
getStatus ( ) : string | Returns the output of a git status -s command. | |
getWrapper ( ) : GitWrapper\GitWrapper | Returns the GitWrapper object that likely instantiated this class. | |
grep ( ) : |
Executes a git grep command. | |
hasChanges ( ) : boolean | Returns true if there are changes to commit. | |
hasRemote ( string $name ) : boolean | Checks if the given remote exists. | |
init ( array $options = [] ) : |
Executes a git init command. | |
isAhead ( ) : boolean | Returns whether HEAD is ahead of its remote tracking branch. | |
isBehind ( ) : boolean | Returns whether HEAD is behind its remote tracking branch. | |
isCloned ( ) : boolean | Checks whether a repository has already been cloned to this directory. | |
isTracking ( ) : boolean | Returns whether HEAD has a remote tracking branch. | |
isUpToDate ( ) : boolean | Returns whether HEAD is up-to-date with its remote tracking branch. | |
log ( ) : |
Executes a git log command. | |
merge ( ) : |
Executes a git merge command. | |
mv ( string $source, string $destination, array $options = [] ) : |
Executes a git mv command. | |
needsMerge ( ) : boolean | Returns whether HEAD needs to be merged with its remote tracking branch. | |
pull ( ) : |
Executes a git pull command. | |
push ( ) : |
Executes a git push command. | |
pushTag ( string $tag, string $repository = 'origin', array $options = [] ) | Helper method that pushes a tag to a repository. | |
pushTags ( string $repository = 'origin', array $options = [] ) | Helper method that pushes all tags to a repository. | |
rebase ( ) : |
Executes a git rebase command. | |
remote ( ) : |
Executes a git remote command. | |
removeRemote ( string $name ) : |
Removes the given remote. | |
reset ( ) : |
Executes a git reset command. | |
rm ( string $filepattern, array $options = [] ) : |
Executes a git rm command. | |
run ( array $args, boolean $setDirectory = true ) : |
Runs a Git command and captures the output. | |
setCloned ( boolean $cloned ) : |
Manually sets the cloned flag. | |
show ( string $object, array $options = [] ) : |
Executes a git show command. | |
status ( ) : |
Executes a git status command. | |
tag ( ) : |
Executes a git tag command. |
public __construct ( gitwrapper\GitWrapper $wrapper, string $directory ) | ||
$wrapper | gitwrapper\GitWrapper | The GitWrapper object that likely instantiated this class. |
$directory | string | Path to the directory containing the working copy. |
public __toString ( ) : string | ||
return | string |
public add ( string $filepattern, array $options = [] ) : |
||
$filepattern | string | Files to add content from. Fileglobs (e.g. *.c) can be given to add all matching files. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively. |
$options | array | An optional array of command line options. |
return |
public addRemote ( string $name, string $url, array $options = [] ) : |
||
$name | string | The name of the remote to add. |
$url | string | The URL of the remote to add. |
$options | array | An associative array of options, with the following keys:
- -f: Boolean, set to true to run git fetch immediately after the
remote is set up. Defaults to false.
- --tags: Boolean. By default only the tags from the fetched branches
are imported when git fetch is run. Set this to true to import every
tag from the remote repository. Defaults to false.
- --no-tags: Boolean, when set to true, git fetch does not import tags
from the remote repository. Defaults to false.
- -t: Optional array of branch names to track. If left empty, all
branches will be tracked.
- -m: Optional name of the master branch to track. This will set up a
symbolic ref 'refs/remotes/ |
return |
public apply ( ) : |
||
return |
public archive ( ) : |
||
return |
public branch ( ) : |
||
return |
public checkout ( ) : |
||
return |
public checkoutNewBranch ( string $branch, array $options = [] ) | ||
$branch | string | The new branch being created. |
$options | array |
public clean ( ) : |
||
return |
public clearOutput ( ) : |
||
return |
public cloneRepository ( string $repository, array $options = [] ) : |
||
$repository | string | The Git URL of the repository being cloned. |
$options | array | (optional) An associative array of command line options. |
return |
public commit ( ) : |
||
return |
public config ( ) : |
||
return |
public diff ( ) : |
||
return |
public fetch ( ) : |
||
return |
public getBranches ( ) : gitwrapper\GitBranches | ||
return | gitwrapper\GitBranches |
public getDirectory ( ) : string | ||
return | string |
public getRemotes ( ) : array | ||
return | array | An associative array, keyed by remote name, containing an associative array with the following keys: - fetch: the fetch URL. - push: the push URL. |
public getWrapper ( ) : GitWrapper\GitWrapper | ||
return | GitWrapper\GitWrapper |
public grep ( ) : |
||
return |
public hasChanges ( ) : boolean | ||
return | boolean |
public isTracking ( ) : boolean | ||
return | boolean |
public isUpToDate ( ) : boolean | ||
return | boolean |
public merge ( ) : |
||
return |
public mv ( string $source, string $destination, array $options = [] ) : |
||
$source | string | The file / directory being moved. |
$destination | string | The target file / directory that the source is being move to. |
$options | array | (optional) An associative array of command line options. |
return |
public needsMerge ( ) : boolean | ||
return | boolean | true if HEAD needs to be merged with the remote, false otherwise. |
public pull ( ) : |
||
return |
public push ( ) : |
||
return |
public pushTag ( string $tag, string $repository = 'origin', array $options = [] ) | ||
$tag | string | The tag being pushed. |
$repository | string | The destination of the push operation, which is either a URL or name of the remote. Defaults to "origin". |
$options | array | (optional) An associative array of command line options. |
public rebase ( ) : |
||
return |
public remote ( ) : |
||
return |
public removeRemote ( string $name ) : |
||
$name | string | The name of the remote to remove. |
return |
public reset ( ) : |
||
return |
public rm ( string $filepattern, array $options = [] ) : |
||
$filepattern | string | Files to remove from version control. Fileglobs (e.g. *.c) can be given to add all matching files. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively. |
$options | array | (optional) An associative array of command line options. |
return |
public show ( string $object, array $options = [] ) : |
||
$object | string | The names of objects to show. For a more complete list of ways to spell object names, see "SPECIFYING REVISIONS" section in gitrevisions(7). |
$options | array | (optional) An associative array of command line options. |
return |
public status ( ) : |
||
return |
public tag ( ) : |
||
return |
protected $cloned |
protected string $directory | ||
return | string |
protected string $output | ||
return | string |