Skip to content

Write-GitBranchName

SYNOPSIS

Writes the branch name given the current Git status.

SYNTAX

Write-GitBranchName [[-Status] <Object>] [-StringBuilder <StringBuilder>] [-NoLeadingSpace]
 [<CommonParameters>]

DESCRIPTION

Writes the branch name given the current Git status which can retrieved via the Get-GitStatus command. Branch name can be affected by the $GitPromptSettings: BranchColor, BranchNameLimit, TruncatedBranchSuffix and Branch*StatusSymbol colors.

EXAMPLES

EXAMPLE 1

Write-GitBranchName (Get-GitStatus)

Writes the name of the current branch.

PARAMETERS

-Status

The Git status object that provides the status information to be written. This object is retrieved via the Get-GitStatus command.

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-StringBuilder

If specified the branch name is written into the provided StringBuilder object.

Type: System.Text.StringBuilder
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-NoLeadingSpace

If specified, suppresses the output of the leading space character.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Management.Automation.PSCustomObject

This is PSCustomObject returned by Get-GitStatus

OUTPUTS

System.String, System.Text.StringBuilder

This command returns a System.String object unless the -StringBuilder parameter

is supplied. In this case, it returns a System.Text.StringBuilder.

NOTES

Back to top