Last active
September 27, 2018 20:20
-
-
Save ksumrall/95c23c0609036ea0649b368b88362551 to your computer and use it in GitHub Desktop.
Powershell command for cleaning up local git branches
This file contains hidden or 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
| # for viewing the matching branches | |
| git branch -vv | foreach { if($_ -match "^\s{2}([^\s]+).+?: gone]"){ Write-Host $matches[1] } } | |
| # to delete the branches | |
| git branch -vv | foreach { if($_ -match "^\s{2}([^\s]+).+?: gone]"){ git branch -d $matches[1] } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment