|
|
#!/bin/env bash
|
|
|
|
|
|
CIBLE=$1
|
|
|
if [ "$CIBLE" == "" ]
|
|
|
then
|
|
|
Using $GIT_CURRENT_BRANCH as cible
|
|
|
CIBLE=$GIT_CURRENT_BRANCH
|
|
|
fi
|
|
|
|
|
|
internal_delete_branch() {
|
|
|
git branch -D $1
|
|
|
git push all --delete $1
|
|
|
}
|
|
|
|
|
|
delete_branch() {
|
|
|
read -p "Delete $1 (y/n) ? " choice
|
|
|
case "$choice" in
|
|
|
y|Y|o|O ) internal_delete_branch $1;;
|
|
|
n|N ) echo "no";;
|
|
|
* ) echo "invalid choice ($choice)";;
|
|
|
esac
|
|
|
}
|
|
|
|
|
|
git_03_push_branch.sh
|
|
|
|
|
|
if [ ! "$GIT_CURRENT_BRANCH" = "develop" ]
|
|
|
then
|
|
|
echo "La branche actuelle n'est pas develop"
|
|
|
read -p "Voulez-vous basculer sur develop ? " -n 1 -r
|
|
|
echo # (optional) move to a new line
|
|
|
if [[ $REPLY =~ ^[YyOo]$ ]]
|
|
|
then
|
|
|
git_98_checkout_branch.sh develop
|
|
|
fi
|
|
|
fi
|
|
|
|
|
|
case $CIBLE in
|
|
|
($GIT_CURRENT_BRANCH) echo "Impossible : $CIBLE is current branch !";;
|
|
|
("evo"*) delete_branch $CIBLE;;
|
|
|
("ano"*) delete_branch $CIBLE;;
|
|
|
(*) echo "$CIBLE is not a feature branch";;
|
|
|
esac
|
|
|
|