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 pull 操作を表しています。プロジェクトの追加や削除が必要な場合は、該当する行を削除するだけで済みます。

各行の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

読み込み中...
文章は、創作者によって署名され、ブロックチェーンに安全に保存されています。