Public/Get-LocalBranches.ps1

1
2
3
4
5
6
7
8
9
<#
    .SYNOPSIS
        Returns the name of all local branches, also including the symbolic HEAD.
#>

function Get-LocalBranches() {
    $branches = Invoke-NativeCommand git for-each-ref refs/heads/ --format="%(refname:short)"
    @('HEAD') + $branches
}