ps/Modules/Cole.PowerShell.Developer/TODO/Clear-MergedGitBranches.ps1

25 lines
609 B
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
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
}
}