git pull 一键拉取代码脚本

 

#!/bin/bash

echo "loading..."

cd /www/dev/api/testproject

#没有提交的修改暂存到stash里面
git stash

curr_branch=$(git symbolic-ref --short -q HEAD)
pub_branch="dev-common"

if [ ${curr_branch} != ${pub_branch} ]; then
   git checkout ${pub_branch} 
fi

git pull

#php /www/dev/api/testproject/init --env=Development --overwrite=all


#projectArr=("testproject1" "testproject2")
#pub_branch="build-dev"

#for project in ${projectArr[@]}
#do
#    echo "....................loading $project...................."
#    cd /www/$project
#
#    curr_branch=$(git symbolic-ref --short -q HEAD)
#
#    if [ ${curr_branch} != ${pub_branch} ]; then
#        git checkout ${pub_branch}
#    fi

#    git pull
#done

 

posted @ 2022-01-13 11:47  一个人的孤独自白  阅读(572)  评论(0编辑  收藏  举报