25 lines
609 B
PowerShell
25 lines
609 B
PowerShell
|
function Clear-MergedGitBranches {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Used to delete branches via git
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
param(
|
||
|
[switch]$Force
|
||
|
)
|
||
|
|
||
|
$branches = Find-MergedGitBranches
|
||
|
|
||
|
$deleteSwitch = "-d"
|
||
|
if ($Force) {
|
||
|
Write-Warning "Sleeping for 10s so you can hit ctrl-c"
|
||
|
Write-Warning "This will delete all the branches by FORCE, that's a big hammer"
|
||
|
Start-Sleep -Seconds 10
|
||
|
$deleteSwitch = "-D"
|
||
|
}
|
||
|
|
||
|
foreach ($branch in $branches) {
|
||
|
$result = Invoke-GitCommand -Verb branch -Arguments @($deleteSwitch, $branch)
|
||
|
Write-Host $result
|
||
|
}
|
||
|
}
|