PHP 클래스 Gush\Helper\GitHelper

상속: extends Symfony\Component\Console\Helper\Helper
파일 보기 프로젝트 열기: gushphp/gush 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( ProcessHelper $processHelper, GitConfigHelper $gitConfigHelper, FilesystemHelper $filesystemHelper )
add ( $path )
addNotes ( $notes, $commitHash, $ref )
branchExists ( string $branch ) : boolean
checkout ( $branchName, $createBranch = false )
clearTempBranches ( )
commit ( $message, array $options = [] )
createRemoteMergeOperation ( ) : Gush\Operation\RemoteMergeOperation
createRemotePatchOperation ( ) : Gush\Operation\RemotePatchOperation
createTempBranch ( $originalBranch )
getActiveBranchName ( string | null $defaultBranch = null ) : string
getCommitCountBetweenLocalAndBase ( $org, $branch, $sourceBranch )
getFirstCommitTitle ( string $base, string $sourceBranch ) : string
getGitDir ( ) : string
getIssueNumber ( )
getLastTagOnBranch ( string $ref = 'HEAD' ) : string
getLogBetweenCommits ( string $start, string $end ) : array[] | array Returns the log commits between two ranges (either commit or branch-name).
getName ( )
guardWorkingTreeReady ( )
isGitDir ( boolean $requireRoot = true ) : boolean Returns whether the current working dir is a Git directory.
isWorkingTreeReady ( )
listFiles ( array $options = [] ) : array
mergeBranch ( string $base, string $sourceBranch, string $commitMessage, boolean $fastForward = false ) : null | string
mergeBranchWithLog ( string $base, string $sourceBranch, string $commitMessage, string $sourceBranchLabel = null ) : string Same as mergeBranch() but appends a commits log to the merge message.
pullRemote ( $remote, $ref = null )
pushToRemote ( $remote, $ref, $setUpstream = false, $force = false )
remoteBranchExists ( string $remote, string $branch ) : boolean
remoteUpdate ( $remote = null )
reset ( $commit, $type = 'soft' )
restoreStashedBranch ( ) Tries to restore back to the original branch the user was in (before executing any command).
squashCommits ( string $base, string $branchName, boolean $ignoreMultipleAuthors = false )
stashBranchName ( ) Stashes the active branch-name.
switchBranchBase ( $branchName, $currentBase, $newBase, $newBranchName = null )
syncWithRemote ( $remote, $branchName = null )
undefinedToDefault ( string $value, string | null $default = null ) : null | string

메소드 상세

__construct() 공개 메소드

public __construct ( ProcessHelper $processHelper, GitConfigHelper $gitConfigHelper, FilesystemHelper $filesystemHelper )
$processHelper ProcessHelper
$gitConfigHelper GitConfigHelper
$filesystemHelper FilesystemHelper

add() 공개 메소드

public add ( $path )

addNotes() 공개 메소드

public addNotes ( $notes, $commitHash, $ref )

branchExists() 공개 메소드

public branchExists ( string $branch ) : boolean
$branch string
리턴 boolean

checkout() 공개 메소드

public checkout ( $branchName, $createBranch = false )

clearTempBranches() 공개 메소드

public clearTempBranches ( )

commit() 공개 메소드

public commit ( $message, array $options = [] )
$options array

createRemoteMergeOperation() 공개 메소드

public createRemoteMergeOperation ( ) : Gush\Operation\RemoteMergeOperation
리턴 Gush\Operation\RemoteMergeOperation

createRemotePatchOperation() 공개 메소드

public createRemotePatchOperation ( ) : Gush\Operation\RemotePatchOperation
리턴 Gush\Operation\RemotePatchOperation

createTempBranch() 공개 메소드

public createTempBranch ( $originalBranch )

getActiveBranchName() 공개 메소드

public getActiveBranchName ( string | null $defaultBranch = null ) : string
$defaultBranch string | null
리턴 string The branch name

getCommitCountBetweenLocalAndBase() 공개 메소드

public getCommitCountBetweenLocalAndBase ( $org, $branch, $sourceBranch )

getFirstCommitTitle() 공개 메소드

public getFirstCommitTitle ( string $base, string $sourceBranch ) : string
$base string The base branch name
$sourceBranch string The source branch name
리턴 string The title of the first commit on sourceBranch off of base or an empty string in the case of an error

getGitDir() 공개 메소드

public getGitDir ( ) : string
리턴 string

getIssueNumber() 공개 메소드

public getIssueNumber ( )

getLastTagOnBranch() 공개 메소드

public getLastTagOnBranch ( string $ref = 'HEAD' ) : string
$ref string commit/branch or HEAD (default is HEAD)
리턴 string The tag name

getLogBetweenCommits() 공개 메소드

Returned result is an array like: [ ['sha' => '...', 'author' => '...', 'subject' => '...', 'message' => '...'], ] Note; - Commits are by default returned in order of oldest to newest. - sha is the full commit-hash - author is the author name and e-mail address like "My Name " - Message contains the subject followed by two new lines and the actual message-body. Or an empty array when there are no logs.
public getLogBetweenCommits ( string $start, string $end ) : array[] | array
$start string
$end string
리턴 array[] | array

getName() 공개 메소드

public getName ( )

guardWorkingTreeReady() 공개 메소드

isGitDir() 공개 메소드

Returns whether the current working dir is a Git directory.
public isGitDir ( boolean $requireRoot = true ) : boolean
$requireRoot boolean Require directory is the root of the Git repository, default is true.
리턴 boolean

isWorkingTreeReady() 공개 메소드

public isWorkingTreeReady ( )

listFiles() 공개 메소드

public listFiles ( array $options = [] ) : array
$options array
리턴 array Files in the git repository

mergeBranch() 공개 메소드

public mergeBranch ( string $base, string $sourceBranch, string $commitMessage, boolean $fastForward = false ) : null | string
$base string The base branch name
$sourceBranch string The source branch name
$commitMessage string Commit message to use for the merge-commit
$fastForward boolean Perform merge using fast-forward (default false)
리턴 null | string The merge-commit hash or null when fast-forward was used

mergeBranchWithLog() 공개 메소드

Same as mergeBranch() but appends a commits log to the merge message.
public mergeBranchWithLog ( string $base, string $sourceBranch, string $commitMessage, string $sourceBranchLabel = null ) : string
$base string The base branch name
$sourceBranch string The source branch name
$commitMessage string Commit message to use for the merge-commit
$sourceBranchLabel string Actual branch (to use as replacement for the log) Else the temp-branch name is used.
리턴 string The merge-commit hash

pullRemote() 공개 메소드

public pullRemote ( $remote, $ref = null )

pushToRemote() 공개 메소드

public pushToRemote ( $remote, $ref, $setUpstream = false, $force = false )

remoteBranchExists() 공개 메소드

public remoteBranchExists ( string $remote, string $branch ) : boolean
$remote string Remote name or git-repository url
$branch string
리턴 boolean

remoteUpdate() 공개 메소드

public remoteUpdate ( $remote = null )

reset() 공개 메소드

public reset ( $commit, $type = 'soft' )

restoreStashedBranch() 공개 메소드

Tries to restore back to the original branch the user was in (before executing any command).

squashCommits() 공개 메소드

public squashCommits ( string $base, string $branchName, boolean $ignoreMultipleAuthors = false )
$base string
$branchName string
$ignoreMultipleAuthors boolean Ignore there are multiple authors (ake force)

stashBranchName() 공개 메소드

This will only stash the branch-name when no other branch was active already.
public stashBranchName ( )

switchBranchBase() 공개 메소드

public switchBranchBase ( $branchName, $currentBase, $newBase, $newBranchName = null )

syncWithRemote() 공개 메소드

public syncWithRemote ( $remote, $branchName = null )

undefinedToDefault() 공개 정적인 메소드

public static undefinedToDefault ( string $value, string | null $default = null ) : null | string
$value string
$default string | null
리턴 null | string