Skip to content

Commit

Permalink
Add delobra.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
do-adams committed Feb 2, 2017
1 parent 6d743b7 commit 91e7cf9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions delobra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 91e7cf9

Please sign in to comment.