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

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。