Created
November 7, 2021 16:48
-
-
Save GerardoHP/dc5d2814fca1dd71eee2639ebe7ab09f to your computer and use it in GitHub Desktop.
SH to delete all of the branches excluding some
This file contains hidden or 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
cd /c/Users/ghern/source/repos/bn3/bn3-backend-${1} | |
current_branch=$(git branch --show-current) | |
branches_to_delete=$(git branch -l | grep -v "dev" | grep -v "release/1.0.0" | grep -v $current_branch) | |
for branch in $branches_to_delete; do | |
git branch -D ${branch} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment