< Back

Invoke-Git

Sun Jan 12, 2020 6:47 pm

NAME Invoke-Git



SYNOPSIS

Wrapper to invoke git and return streams





SYNTAX

Invoke-Git [[-Arguments] <Object>] [-NoWindow <Object>] [-RedirectStandardError <Object>] [-RedirectStandardOutput

<Object>] [-UseShellExecute <Object>] [-Path <Object>] [-Quiet <Object>] [-Split <Object>] [-Raw <Object>]

[-GitPath <String>] [<CommonParameters>]





DESCRIPTION

Wrapper to invoke git and return streams





PARAMETERS

-Arguments <Object>

If specified, call git with these arguments.



This takes a positional argument and accepts all value afterwards for a more natural 'git-esque' use.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoWindow <Object>



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-RedirectStandardError <Object>

Whether to capture standard error. Defaults to $true



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-RedirectStandardOutput <Object>

Whether to capture standard output. Defaults to $true



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-UseShellExecute <Object>

See System.Diagnostics.ProcessStartInfo. Defaults to $false



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Path <Object>

Working directory to launch git within. Defaults to current location



Required? false

Position? named

Default value $PWD.Path

Accept pipeline input? false

Accept wildcard characters? false



-Quiet <Object>

If specified, do not return output



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Split <Object>

If specified, split output and error on this. Defaults to `n



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Raw <Object>

If specified, return an object with the command, output, and error properties.



Without Raw or Quiet, we return output if there's output, and we write an error if there are errors



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-GitPath <String>

Path to git. Defaults to git (i.e. git is in $ENV:PATH)



Required? false

Position? named

Default value git

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:\\>Invoke-Git rev-parse HEAD



# Get the current commit hash for HEAD









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



PS C:\\>Invoke-Git rev-parse HEAD -path C:\\sc\\PSStackExchange



# Get the current commit hash for HEAD for the repo located at C:\\sc\\PSStackExchange











RELATED LINKS

https://github.com/RamblingCookieMonster/BuildHelpers

about_BuildHelpers