-
Notifications
You must be signed in to change notification settings - Fork 1
/
delobra.sh
36 lines (28 loc) · 1.31 KB
/
delobra.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# delobra.sh - delete local branches
# bash script for deleting local branches in a git repository
getMergedBranches ()
{
git branch --merged develop | grep -v -e develop -e master
}
cat << "EOF"
| $$ | $$ | $$
/$$$$$$$ /$$$$$$ | $$ /$$$$$$ | $$$$$$$ /$$$$$$ /$$$$$$
/$$__ $$ /$$__ $$| $$ /$$__ $$| $$__ $$ /$$__ $$|____ $$
| $$ | $$| $$$$$$$$| $$| $$ \ $$| $$ \ $$| $$ \__/ /$$$$$$$
| $$ | $$| $$_____/| $$| $$ | $$| $$ | $$| $$ /$$__ $$
| $$$$$$$| $$$$$$$| $$| $$$$$$/| $$$$$$$/| $$ | $$$$$$$
\_______/ \_______/|__/ \______/ |_______/ |__/ \_______/
EOF
sleep .5
echo "delobra will delete the following local branches from your Git repository:"
getMergedBranches
while true; do
read -p "Do you wish to continue? (Press Y/y to continue or N/n to exit) " ans
case $ans in
[Yy]* ) getMergedBranches | xargs git branch -d;
echo "delobra has deleted your local branches."; break;;
[Nn]* ) echo "delobra has exited - no branches were deleted."; exit;;
* ) echo "Please answer yes or no.";;
esac
done