自动提交git仓库sh命令
#!/bin/sh
echo -e "\033[32m <<<<<<<<<\n正在拉取远程代码...\n>>>>>>>>> \033[0m"
git pull
echo -e "\033[32m <<<<<<<<<\n正在添加文件...\n>>>>>>>>> \033[0m"
git add .
echo -e -n "\033[33m <<<<<<<<<\n请填写备注信息(可为空):\n>>>>>>>>> \033[0m"
read remarks
if [ ! -n "$remarks" ]
then
remarks="fix: 常规提交部署测试服"
fi
git commit -am "$remarks"
echo -e "\033[32m <<<<<<<<<\n正在提交代码...\n>>>>>>>>> \033[0m"
git push
git checkout master
git pull
echo -e "\033[32m <<<<<<<<<\n合并dev代码中...\n>>>>>>>>> \033[0m"
git merge dev
echo -e "\033[32m <<<<<<<<<\n推送测试服成功,等待构建...\n>>>>>>>>> \033[0m"
git push
git checkout dev
exit
配合package.json一起
"scripts": {
"pushtest": "sh ./test.sh"
},