- class
Git
(git\Git
) - package
git
- source
git/Git.php
Description
Class Git
->
__construct()
- Git constructor.->
init()
->
resolve()
- Parse a git revision string and return an object id.->
resolveCommit()
->
getDirectory()
->
getWorkTree()
->
getBranch()
->
getFullBranch()
->
getRemoteName()
->
findRef()
- Search for a ref by (possibly abbreviated) name.->
exactRef()
- Get a ref by name.->
getState()
- SAFE, MERGING, MERGING_RESOLVED, CHERRY_PICKING, CHERRY_PICKING_RESOLVED, REVERTING, REVERTING_RESOLVED, REBASING,->
isBare()
->
isExists()
->
getTags()
->
setCredentials()
->
setTransportConfig()
- Transport global config for push, fetch, pull, etc.->
remoteList()
->
remoteAdd()
->
remoteSetUrl()
->
remoteRemove()
->
status()
- Status git command, options:->
diff()
- Diff git command, options are:->
reflog()
->
log()
- Options are:->
branchList()
- Return branches, options are:->
branchCreate()
- Create branch, options are:->
branchRename()
- Used to rename branches.->
branchDelete()
- Used to delete one or several branches.->
add()
- Add git command, options:->
commit()
- Add git command, options:->
push()
- Push git command, options:->
fetch()
- Fetch git command, options are:->
pull()
- Pull command, options:->
merge()
- Options:->
reset()
- Options are:->
clean()
- Clean git command, options:->
rm()
->
checkout()
- Checkout git command, options are:->
stashCreate()
- Stash create git command, options are:->
stashApply()
- Options are:->
stashDrop()
- Options are:->
stashList()
- Stash list git command.
__construct(string $directory, bool $createIfNotExists): void
Git constructor.
init(bool $bare): void
resolve(string $revstr): array
Parse a git revision string and return an object id.
- Combinations of these operators are supported:
HEAD, MERGE_HEAD, FETCH_HEAD
SHA-1: a complete or abbreviated SHA-1
refs/...: a complete reference name
short-name: a short reference name under {@code refs/heads},
{@code refs/tags}, or {@code refs/remotes} namespace
tag-NN-gABBREV: output from describe, parsed by treating
{@code ABBREV} as an abbreviated SHA-1.
id^: first parent of commit id, this is the same
as {@code id^1}
id^0: ensure id is a commit
id^n: n-th parent of commit id
idn: n-th historical ancestor of id, by first
parent. {@code id3} is equivalent to {@code id^1^1^1} or {@code id^^^}.
id:path: Lookup path under tree named by id
id^{commit}: ensure id is a commit
id^{tree}: ensure id is a tree
id^{tag}: ensure id is a tag
id^{blob}: ensure id is a blob
resolveCommit(string $revstr): string
getDirectory(): File
getWorkTree(): File
getBranch(): string
getFullBranch(): string
getRemoteName(string $name): string
findRef(string $name): array
Search for a ref by (possibly abbreviated) name.
exactRef(string $name): array
Get a ref by name.
getState(): string
SAFE, MERGING, MERGING_RESOLVED, CHERRY_PICKING, CHERRY_PICKING_RESOLVED, REVERTING, REVERTING_RESOLVED, REBASING, REBASING_REBASING, APPLY, REBASING_MERGE, REBASING_INTERACTIVE, BISECTING
isBare(): bool
isExists(): bool
getTags(): array[]
setCredentials(string $username, string $password): void
setTransportConfig(array $config): void
Transport global config for push, fetch, pull, etc.
Config is an array:
timeout => int (seconds) dryRun => bool checkFetchedObjects => bool fetchThin => bool pushAtomic => bool pushThin => bool removeDeletedRefs => bool
sshPassword => string sshHost => string sshPort => int
sshIdentity => [privateKey => string, publicKey => string (optional), passphrase => string (optional)] sshKnownHosts => string or Stream (path to file)
remoteList(): array
remoteAdd(string $name, string $uri): array
remoteSetUrl(string $name, string $uri): array
remoteRemove(string $name): array
status(array|null $paths, array|null $options): array
Status git command, options:
ignoreSubmoduleMode => string (ALL|DIRTY|UNTRACKED|NONE)
Return array value:
added => [...] changed => [...] conflicting => [...] ignoredNotInIndex => [...] missing => [...] modified => [...] removed => [...] uncommittedChanges => [...] untracked => [...] untrackedFolders => [...]
diff(array $options): array
Diff git command, options are:
cached => bool contextLines => int destPrefix => string sourcePrefix => string showNameAndStatusOnly => bool pathFilter => string
reflog(string $ref): array
log(array $options): array[]
Options are:
maxCount => int skip => int all => bool paths => string[] or string
range => [fromId, toId (nullable)]
branchList(array $options): array
Return branches, options are:
listMode => string (ALL|REMOTE) contains => string (a commit ID or ref name)
branchCreate(string $name, array $options): array
Create branch, options are:
force => bool startPoint => string (rev commit) upstreamMode => string (TRACK|NOTRACK|SET_UPSTREAM)
branchRename(string $newName, string $oldName): array
Used to rename branches.
branchDelete(array $names, bool $force): string[]
Used to delete one or several branches.
The result of call is a list with the (full) names of the deleted branches.
add(string $filePattern, array $options): void
Add git command, options:
update => bool
commit(string $message, array $options): array
Add git command, options:
all => bool allowEmpty => bool amend => bool insertChangeId => bool noVerify => bool only => string reflogComment => string
author => [name, email] committer => [name, email]
push(string $remote, array $options): array[]
Push git command, options:
atomic => bool dryRun => bool force => bool all => bool tags => bool receivePack => string thin => bool timeout => int (millis) credentials => [username, password]
fetch(array $options): array
Fetch git command, options are:
checkFetchedObjects => bool dryRun => bool removeDeletedRefs => bool thin => bool remote => string recurseSubmodules => string (YES|NO|ON_DEMAND) tagOpt => string (AUTO_FOLLOW|NO_TAGS|FETCH_TAGS) timeout => int (seconds) credentials => [username, password]
pull(string $remote, array $options): array
Pull command, options:
rebase => bool branch => string strategy => string (ours, theirs, resolve, recursive, simple-two-way-in-core) timeout => int (seconds) credentials => [username, password]
merge(array $revs, array $options): array
Options:
commit => bool message => string squash => bool fastForward => string (FF|NO_FF|FF_ONLY) strategy => string (ours, theirs, resolve, recursive, simple-two-way-in-core)
reset(array $options): array
Options are:
mode => string (SOFT|MIXED|HARD) ref => string disableRefLog => bool paths => string[] or string
clean(array $options): string[]
Clean git command, options:
cleanDirectories => bool dryRun => bool force => bool ignore => bool paths => string[]
rm(string $filePattern, bool $cached): void
checkout(array $options): array
Checkout git command, options are:
allPaths => bool createBranch => bool force => bool orphan => bool name => string stage => string (BASE|OURS|THEIRS) startPoint => string (a commit ID or ref name) upstreamMode => string (TRACK|NOTRACK|SET_UPSTREAM) paths => string[] or string
stashCreate(array $options): array
Stash create git command, options are:
includeUntracked => bool indexMessage => string ref => string workingDirectoryMessage => string
stashApply(array $options): array
Options are:
applyIndex => bool applyUntracked => bool stashRef => string strategy => string
stashDrop(array $options): array
Options are:
all => bool stashRef => int
stashList(): array
Stash list git command.