Last active
September 2, 2016 20:52
-
-
Save absynce/5e89a4533ceecebd914f41cc85076d83 to your computer and use it in GitHub Desktop.
Delete local git branch when pruned 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 remote prune origin > delete-branches.txt | |
# Filter out non-branch names. | |
grep -oP '(?<=] origin\/).*' ./delete-branches.txt | xargs -L1 git br -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment