Skip to content

Instantly share code, notes, and snippets.

@fabricionaweb
Forked from moiseshilario/deletelocalbranches.sh
Created November 13, 2019 15:40
Show Gist options
  • Save fabricionaweb/2e7f411c1cc62eb765c3ea15461520ab to your computer and use it in GitHub Desktop.
Save fabricionaweb/2e7f411c1cc62eb765c3ea15461520ab to your computer and use it in GitHub Desktop.
Delete local branches (git)
# Delete branches that are already merged (but master/development/stage)
git branch --merged | egrep -v "(^\*|master|development|stage)" | xargs git branch -d
# Delete all local branches (but master/development/stage)
git branch | egrep -v "(^\*|master|development|stage)" | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment