refactorsaurusrex
3/5/2015 - 4:25 PM

Delete all local git branches

Delete all local git branches

function Delete-LocalBranches ($Commit = 'HEAD', [switch]$Force) {
    git branch |
        ? { $_ -notmatch '(^\*)|(^. master$)' } |
        % { git branch $(if($Force) { '-D' } else { "-d" }) $_.Substring(2) }
}