Sunday, April 17, 2016

Remove Git branches with `*` (asterisk)

To remove Git local branches with `*`, you can do as follows:

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

To remove Git remote branches with `*`, you can do as follows:

git branch | grep "polish" | xargs git push origin --delete

References:
http://stackoverflow.com/questions/3670355/can-you-delete-multiple-branches-in-one-command-with-git
http://stackoverflow.com/questions/2003505/delete-a-git-branch-both-locally-and-remotely

No comments:

Post a Comment