Skip to content

Instantly share code, notes, and snippets.

@droid001
Created March 31, 2021 11:24
Show Gist options
  • Save droid001/575e7e546d74295133fc8cd69a1a91dd to your computer and use it in GitHub Desktop.
Save droid001/575e7e546d74295133fc8cd69a1a91dd to your computer and use it in GitHub Desktop.
Script for git which deletes local branches which are deleted remotely
git config --global alias.gone "! git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '\$2 == \"[gone]\" {print \$1}' | xargs -r git branch -D"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment