Skip to content

Instantly share code, notes, and snippets.

@ksumrall
Last active September 27, 2018 20:20
Show Gist options
  • Select an option

  • Save ksumrall/95c23c0609036ea0649b368b88362551 to your computer and use it in GitHub Desktop.

Select an option

Save ksumrall/95c23c0609036ea0649b368b88362551 to your computer and use it in GitHub Desktop.
Powershell command for cleaning up local git branches
# 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