+ BRANCH=`cd "$1"; git branch -a --no-color --contains HEAD | sed -e s/\*\ // | sed -e s/\(no\ branch\)//`
+ if ( echo $BRANCH | egrep origin/master > /dev/null ); then
+ #give a priority to master branch
+ BRANCH='master'
+ else
+ BRANCH=`echo $BRANCH | cut -d ' ' -f 1`
+ BRANCH=${BRANCH#*/}
+ fi