Created
March 4, 2022 21:21
-
-
Save ozydingo/12a5b3882d64c39ad83713a96e7ca996 to your computer and use it in GitHub Desktop.
Delete local git branches that were deleted from remote
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
git fetch -p | |
git branch -vv | \ | |
awk '$3 ~ /\[[[:punct:][:alnum:]]+:/ && $4 == "gone]" { print $1}' | \ | |
while read branch; do echo git branch -D $branch; git branch -D $branch; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment