banner
半米牙

半米牙的笔记

分享技术、记录生活
email

一键更新多个git项目

在开发过程中,往往需要多个 git 项目同时更新,每次需要打开每个项目然后手动拉取比较费事,于是写了个脚本,方便一键更新。

Windows#

脚本内容如下:

#!/bin/bash
echo "echemi_api_backstage" && cd /c/dev/codeup/echemi_api_backstage && git pull --all && echo "" 
echo "echemi_api_cmstop" && cd /c/dev/codeup/echemi_api_cmstop && git pull --all && echo "" 
echo "echemi_api_es" && cd /c/dev/codeup/echemi_api_es && git pull --all && echo "" 
echo "echemi_api_supplier" && cd /c/dev/codeup/echemi_api_supplier && git pull --all && echo "" 
echo "echemi_api_third_party" && cd /c/dev/codeup/echemi_api_third_party && git pull --all && echo "" 
echo "echemi_api_web" && cd /c/dev/codeup/echemi_api_web && git pull --all && echo "" 
echo "echemi_backstage" && cd /c/dev/codeup/echemi_backstage && git pull --all && echo "" 
echo "echemi_eu" && cd /c/dev/codeup/echemi_eu && git pull --all && echo "" 
echo "echemi_pay" && cd /c/dev/codeup/echemi_pay && git pull --all && echo "" 
echo "echemi_supplier" && cd /c/dev/codeup/echemi_supplier && git pull --all && echo "" 
echo "echemi_ucenter" && cd /c/dev/codeup/echemi_ucenter && git pull --all && echo "" 
echo "echemi_user" && cd /c/dev/codeup/echemi_user && git pull --all && echo "" 
echo "echemi_web_en" && cd /c/dev/codeup/echemi_web_en && git pull --all && echo "" 
echo "echemi_web_zh" && cd /c/dev/codeup/echemi_web_zh && git pull --all && echo "" 
echo "echemi_mail_system_analyze" && cd /c/dev/codeup/echemi_mail_system_analyze && git pull --all && echo "" 
echo "echemi_mail_system_batch" && cd /c/dev/codeup/echemi_mail_system_batch && git pull --all echo "" 
echo "echemi_wechat" && cd /c/dev/codeup/echemi_wechat && git pull --all echo "" 
echo "echemi_api_wechat" && cd /c/dev/codeup/echemi_api_wechat && git pull --all echo ""

其中,每一行代表着一个工程的 git 拉取操作,如果需要新增或者删减工程,只需要将所在的那一行删除即可。

每一行中,echo后面引号中的是提示文言,我写的是工程名,在运行的时候方便知道更新到哪个工程了;/c/dev/codeup/echemi_api_backstage 是工程所在路径,在 Windows 下,如果路径是

C:\dev\codeup\echemi_api_backstage

git1

然后右击~打开方式~用 Git for Windows 打开运行就可以了

git2

运行结果:

git3

下载地址#

我把写好的脚本压缩好后上传到网盘了,需要的同学自取。

下载 https://banmiya.lanzoum.com/iV4kv0yxv0hg
密码 bfh9

加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。