Skip to content

Instantly share code, notes, and snippets.

@absynce
Last active September 2, 2016 20:52
Show Gist options
  • Save absynce/5e89a4533ceecebd914f41cc85076d83 to your computer and use it in GitHub Desktop.
Save absynce/5e89a4533ceecebd914f41cc85076d83 to your computer and use it in GitHub Desktop.
Delete local git branch when pruned from remote
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