Module/GIT/Remove-BCSBranchNotOnRemote.ps1
<#
.SYNOPSIS .DESCRIPTION .EXAMPLE .NOTES Author: Mathias Stjernfelt Website: http://www.brightcom.se #> function Remove-BCSBranchNotOnRemote { [CmdletBinding(SupportsShouldProcess = $true)] Param( ) try { if ($PSCmdlet.ShouldProcess("Target", "Operation")) { git remote update origin --prune; git branch -vv | Select-String -Pattern ": gone]" | % { $_.toString().Trim().Split(" ")[0] } | % { git branch -D $_ } } } catch { throw "An error occured: $_.Exception"; } } Export-ModuleMember -Function Remove-BCSBranchNotOnRemote |