-
-
Save iPublicis/e38b951076eb57dd694ff3ea3698f2e0 to your computer and use it in GitHub Desktop.
Delete feature branch with prefix locally then remove all remote feature branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stole from: | |
# http://stackoverflow.com/questions/32122784/alias-script-to-delete-all-local-and-remote-git-branches-with-a-specific-prefix | |
git branch -D $(printf "%s\n" $(git branch) | grep 'feature/') | |
# Or this will work too to remove all remote branches: | |
# https://coderwall.com/p/eis0ba/remove-a-thousand-stale-remote-branches-on-git | |
git branch -r | awk -F/ '/\/feature/{print $2}' | xargs -I {} git push origin :{} | |
# Prune all origin branches | |
git remote prune origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment