Last active
March 18, 2024 19:25
-
-
Save shanerk/65815ca1e95ebb88cfc148f8d5df83fe to your computer and use it in GitHub Desktop.
Cleanup Local Branches which were deleted on the remote
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
git fetch -p | |
git for-each-ref --format '%(refname:short) %(upstream:track)' | | |
awk '$2 == "[gone]" {print $1}' | | |
xargs git branch -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment