Skip to content

Instantly share code, notes, and snippets.

@nzroller
Created August 19, 2016 06:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzroller/d325a87b88f03601ff55c5b19ffe1490 to your computer and use it in GitHub Desktop.
Save nzroller/d325a87b88f03601ff55c5b19ffe1490 to your computer and use it in GitHub Desktop.
Github squash-merge PR local cleanup
#!/bin/sh
# Delete local branches whose upstream has been removed
# (useful for Github squashed and merged branches)
# WARNING: git branch -D will force delete branches!
git branch -vv | grep ' gone' | cut -d' ' -f1-3 | xargs -i git branch -D {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment