[git-delete-branch] Added the $1

This commit is contained in:
Marcin Woźniak 2022-11-27 00:38:11 +01:00
parent 7ab0fda74f
commit e2603d5006
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -10,21 +10,36 @@ function delete_remote_branch() {
git push origin --delete "$1" git push origin --delete "$1"
} }
function list_of_the_branches() {
echo echo
echo "List of branches:" echo "List of branches:"
echo -e "$(git branch)" echo -e "$(git branch)"
echo echo
}
BRANCH="$1"
while true; do while true; do
[ -z "$BRANCH" ] && {
list_of_the_branches
read -p "Select branch to remove: " BRANCH read -p "Select branch to remove: " BRANCH
}
echo "$BRANCH"
read -p "Remove locally / remote / both [L/R/B]: " CHOOSE read -p "Remove locally / remote / both [L/R/B]: " CHOOSE
case $CHOOSE in case $CHOOSE in
[Bb]*) [Bb]*)
delete_local_branch "$BRANCH" delete_local_branch "$BRANCH"
delete_remote_branch "$BRANCH" delete_remote_branch "$BRANCH"
unset -f BRANCH
;;
[Ll]*)
delete_local_branch "$BRANCH"
unset -f BRANCH
;;
[Rr]*)
delete_remote_branch "$BRANCH"
unset -f BRANCH
;; ;;
[Ll]*) delete_local_branch "$BRANCH" ;;
[Rr]*) delete_remote_branch "$BRANCH" ;;
*) echo "Please write good answer" ;; *) echo "Please write good answer" ;;
esac esac
done done