-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathquick-push.sh
More file actions
executable file
·70 lines (55 loc) · 1.39 KB
/
quick-push.sh
File metadata and controls
executable file
·70 lines (55 loc) · 1.39 KB
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
#!/bin/bash
# 快速发布脚本 - 简化版本
# 用于快速提交代码和推送到GitHub
set -e
# 颜色定义
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}FileCodeBox 快速发布工具${NC}"
echo "=================================="
# 检查Git状态
echo -e "${BLUE}📋 检查Git状态...${NC}"
git status
# 获取提交信息
if [[ -n "$1" ]]; then
COMMIT_MSG="$1"
else
echo ""
echo -e "${YELLOW}💬 请输入提交信息:${NC}"
read -r COMMIT_MSG
fi
if [[ -z "$COMMIT_MSG" ]]; then
COMMIT_MSG="更新代码 $(date '+%Y-%m-%d %H:%M:%S')"
fi
echo ""
echo -e "${BLUE}📝 提交信息: ${NC}$COMMIT_MSG"
# 确认操作
echo ""
echo -e "${YELLOW}🔍 即将执行的操作:${NC}"
echo "1. git add ."
echo "2. git commit -m \"$COMMIT_MSG\""
echo "3. git push origin main"
echo ""
read -p "是否继续? (Y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo "操作已取消"
exit 0
fi
# 执行Git操作
echo ""
echo -e "${BLUE}📦 添加文件到暂存区...${NC}"
git add .
echo -e "${BLUE}💾 提交更改...${NC}"
git commit -m "$COMMIT_MSG"
echo -e "${BLUE}🚀 推送到GitHub...${NC}"
git push origin main
echo ""
echo -e "${GREEN}✅ 发布完成!${NC}"
echo -e "${GREEN}🎉 代码已成功推送到GitHub${NC}"
# 显示最新的提交信息
echo ""
echo -e "${BLUE}📋 最新提交信息:${NC}"
git log --oneline -1