Created
February 29, 2012 22:22
-
-
Save anaisbetts/1944933 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dontcare = git fetch origin --prune | |
$branches = git branch -a --merged | | |
?{$_ -match "remotes\/origin"} | | |
?{$_ -notmatch "\/master"} | | |
%{$_.Replace("remotes/origin/", "").Trim() } | |
if (-not $branches) { | |
echo "No merged branches detected" | |
exit 0 | |
} | |
echo $branches | |
$title = "Delete Merged Branches" | |
$message = "Do you want to delete the already-merged remote branches displayed above??" | |
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", ` | |
"Delete the remote branches listed." | |
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", ` | |
"Leave the branches alone." | |
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no) | |
$result = $host.ui.PromptForChoice($title, $message, $options, 1) | |
if ($result -eq 1) { | |
exit 0 | |
} | |
$branches | %{ git push origin ":$_" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment