-
Notifications
You must be signed in to change notification settings - Fork 25
/
git-push-all.sh
76 lines (69 loc) · 1.39 KB
/
git-push-all.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /bin/bash
project_names=(
"micro-mall-api"
"micro-mall-users"
"micro-mall-users-consumer"
"micro-mall-users-cron"
"micro-mall-shop"
"micro-mall-shop-cron"
"micro-mall-trolley"
"micro-mall-sku"
"micro-mall-sku-cron"
"micro-mall-order"
"micro-mall-order-cron"
"micro-mall-order-consumer"
"micro-mall-pay"
"micro-mall-pay-consumer"
"micro-mall-logistics"
"micro-mall-comments"
"micro-mall-search"
"micro-mall-search-cron"
"micro-mall-search-shop-consumer"
"micro-mall-search-sku-consumer"
"micro-mall-search-users-consumer"
"micro-mall-search-order-consumer"
)
# shellcheck disable=SC2236
if [ ! -n "$1" ]; then
echo "请输入git commit 信息"
exit 1
else
echo ""
fi
# shellcheck disable=SC2034
commitMsg="$1"
function loopPathGitPush() {
for file in ${project_names[*]}; do
cd "$file" || exit
echo "=> $file"
git status
# shellcheck disable=SC2046
# statusConfirm $(pwd)
git add .
git commit -m "$commitMsg"
git push origin
git push github
cd ../
done
}
function statusConfirm() {
read -r -p "确认提交吗? [Y-y/N-n] " input
case $input in
[yY][eE][sS]|[yY])
echo "Yes"
;;
[nN][oO]|[nN])
echo "No"
exit 1
;;
*)
echo "Invalid input..."
exit 1
;;
esac
}
# 返回上一级
cd ../
# 遍历所有目录 执行git push
# shellcheck disable=SC2046
loopPathGitPush $(pwd)