Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

48 righe
977 B

#!/bin/env bash
DIRNAME=`dirname $0`
git_current_branch() {
 	git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
CUR_BRANCH=`git_current_branch`
CIBLE=$1
if [ "$CIBLE" == "" ]
then
	CIBLE=$CUR_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
}
$DIRNAME/03_push_branch.sh
if [ ! "$CUR_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
		$DIRNAME/00_checkout_branch.sh develop
	fi
fi
case $CIBLE in
	($CUR_BRANCH) echo "Impossible : $CIBLE is current branch !";;
	("evo"*) delete_branch $CIBLE;;
	("ano"*) delete_branch $CIBLE;;
	(*) echo "$CIBLE is not a feature branch";;
esac