< Back

Get-GitBehind

Mon Jan 13, 2020 8:34 pm

NAME Get-GitBehind



SYNOPSIS

Compare a branch with another to find out how many commits behind it is.





SYNTAX

Get-GitBehind [[-ReferenceBranch] <String>] [[-DifferenceBranch] <String>] [-ShowAhead] [<CommonParameters>]





DESCRIPTION

Compare a branch with another to find out how many commits behind (and optionally, ahead) it is. Requires git to

be installed. "git fetch" is called each time the function is called.





PARAMETERS

-ReferenceBranch <String>

The branch you're referring to. Defaults to your current branch



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DifferenceBranch <String>

The branch you want to compare against the reference branch. Defaults to origin/master.



Required? false

Position? 2

Default value origin/master

Accept pipeline input? false

Accept wildcard characters? false



-ShowAhead [<SwitchParameter>]

Supply this switcdh parameter to also get the number of commits ahead of the difference branch.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Compare your current branch against origin/master



cd C:\\your\\repo

Get-GitBehind









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Explicitly set branches to compare



cd C:\\your\\repo

$ReferenceBranch = "feature/myfeature"

$DifferenceBranch = "origin/master"

Get-GitBehind -ReferenceBranch $ReferenceBranch -DifferenceBranch $DifferenceBranch









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Use your current branch as the reference branch



cd C:\\your\\repo

$ReferenceBranch = "feature/myfeature"

$DifferenceBranch = "origin/master"

Get-GitBehind -DifferenceBranch $DifferenceBranch











RELATED LINKS