Skip to content

Instantly share code, notes, and snippets.

@federicomichela
Created March 7, 2020 08:05
Show Gist options
  • Save federicomichela/905291b4b09b152fb0e4dc36ff8b14d6 to your computer and use it in GitHub Desktop.
Save federicomichela/905291b4b09b152fb0e4dc36ff8b14d6 to your computer and use it in GitHub Desktop.
Remove branches locally and remotely
# [ONLY LOCALLY]
git branch | grep "commonPrefix" | xargs git branch -d
# [ONLY REMOTELY]
git branch --remote | grep -v 'excludeBranch1' | grep -v 'excludeBranch2' | cut -b 10- | xargs git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment