2021-12-02 13:10:31 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# shellcheck disable=2162
|
|
|
|
|
|
|
|
function delete_local_branch(){
|
|
|
|
git branch -D "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
function delete_remote_branch(){
|
|
|
|
git push origin --delete "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "List of branches:"
|
|
|
|
echo -e "$(git branch)"
|
|
|
|
echo
|
|
|
|
|
|
|
|
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" ;;
|
2022-03-06 10:44:13 +01:00
|
|
|
[Ll]* ) delete_local_branch "$BRANCH";;
|
|
|
|
[Rr]* ) delete_remote_branch "$BRANCH";;
|
2021-12-02 13:10:31 +01:00
|
|
|
* ) echo "Please write good answer";;
|
|
|
|
esac
|
|
|
|
done
|