git-delete-branch: Changed logic from and to or in both

This commit is contained in:
Marcin Woźniak 2022-04-06 07:34:50 +02:00
parent 6bc94e1518
commit b044d7a9b3
1 changed files with 9 additions and 6 deletions

View File

@ -2,11 +2,11 @@
# shellcheck disable=2162
function delete_local_branch(){
function delete_local_branch() {
git branch -D "$1"
}
function delete_remote_branch(){
function delete_remote_branch() {
git push origin --delete "$1"
}
@ -19,9 +19,12 @@ while true; do
read -p "Select branch to remove: " BRANCH
read -p "Remove locally / remote / both [L/R/B]: " CHOOSE
case $CHOOSE in
[Bb]* ) delete_local_branch "$BRANCH" && delete_remote_branch "$BRANCH" ;;
[Ll]* ) delete_local_branch "$BRANCH";;
[Rr]* ) delete_remote_branch "$BRANCH";;
* ) echo "Please write good answer";;
[Bb]*)
delete_local_branch "$BRANCH"
delete_remote_branch "$BRANCH"
;;
[Ll]*) delete_local_branch "$BRANCH" ;;
[Rr]*) delete_remote_branch "$BRANCH" ;;
*) echo "Please write good answer" ;;
esac
done