-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
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
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 |