Last active
March 28, 2022 14:05
-
-
Save allartk/d040e4f7d86b0cdeb08cb1eb5794d18d to your computer and use it in GitHub Desktop.
Branch cleanup
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
| #!/bin/bash | |
| echo -e "Current branch: \e[1m$(git rev-parse --abbrev-ref HEAD) \e[0m" | |
| BRANCHES=`git branch --merged | egrep -v "(^\*|master|main|dev)"` | |
| echo "Do you want to remove the following merged branches?" | |
| echo $BRANCHES | |
| echo "Are you sure? (y/n)" | |
| read -n 1 answer | |
| if([[ $answer != 'y' ]]); then | |
| echo "Canceled" | |
| exit | |
| fi | |
| git branch -d $BRANCHES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment