Last active
January 8, 2020 17:42
-
-
Save jeffpapp/3826fd71f44756401c46 to your computer and use it in GitHub Desktop.
Clean Git Merged Branches Powershell
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
# Remove remote branches that don't exist anymore | |
git remote prune origin | |
# List branches, find ones where the origin is gone, then delete each branch name | |
git branch -vv | Select-String -Pattern "origin/.*: gone]" | ForEach-Object{($_ -split "\s+")[1]} | %{git branch -D $_} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment