commit_uploads.sh
925 Bytes
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
#!/bin/bash
# 提交本地所有改动到远程仓库
# 用法: bash commit_uploads.sh [commit message]
set -e
MSG="${1:-chore: update $(date '+%Y-%m-%d %H:%M')}"
echo "========================================="
echo " 1. 提交所有改动"
echo "========================================="
git add -A
if git diff --cached --quiet; then
echo " 没有需要提交的变更,跳过"
else
echo " 变更文件:"
git diff --cached --name-only
git commit -m "$MSG"
echo " 提交完成"
fi
echo ""
echo "========================================="
echo " 2. pull --rebase"
echo "========================================="
git pull --rebase
echo ""
echo "========================================="
echo " 3. push"
echo "========================================="
git push
echo ""
echo "========================================="
echo " 完成!"
echo "========================================="