Skip to content

Instantly share code, notes, and snippets.

@darkmavis1980
Created July 27, 2019 13:40
Show Gist options
  • Save darkmavis1980/e9c4607be6e4cdbe3d0aa40a06c34b2a to your computer and use it in GitHub Desktop.
Save darkmavis1980/e9c4607be6e4cdbe3d0aa40a06c34b2a to your computer and use it in GitHub Desktop.
Delete all git branches matching regex
git branch | grep "<pattern>" | xargs git branch -D
@darkmavis1980
Copy link
Author

darkmavis1980 commented Jul 27, 2019

Example:

git branch | grep "bugfix" | xargs git branch -D

Deletes all the branches containing the word 'bugfix'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment