shell

#!/bin/sh
clear

function showMsg()
{
echo ">>>>>[ \033[37;31m$1\033[0m ]"
}

function showEnter()
{
echo ''
}

lstRepo=(
  项目绝对路径/zcool-event-jsp/
  项目绝对路径/zcool-event-static/
)

showMsg 'function git push test to online env'

for repo in ${lstRepo[@]}
do
showEnter
showMsg '**********Start task**********'

cd $repo

git checkout test

showMsg 'git pull'
git pull

showMsg 'git checkout master'
git checkout master

showMsg 'git merge test to master'
git merge test -m 'merge to master'

read -p 'Push to master branch , Please type [y/n] ; defalult n ==> ' confirm

if [ "$confirm" == y ]; then
showMsg 'git push to online'
git push
else
showMsg 'git master push cancel'
fi

showEnter
showMsg '***********end task***********'
showEnter
done

posted @ 2018-10-30 14:19  Johnny_Ma  阅读(57)  评论(0编辑  收藏  举报