novel-doomsday-resurgence/.novel-sync-temp/scripts/git-setup.sh
唐天洛 5dc8c00de0 feat(sync): 固化小说内容到Git仓库
📚 小说内容:
- 《末日重生-开局囤货十亿物资》33章
- 完整的状态文件、记忆索引、钩子系统

🛠️ 系统配置:
- 版本控制管理系统
- 自动化脚本系统
- 质量监控系统

🧠 固化记忆:
- 长期记忆文件
- 系统配置文档
- 恢复流程指南

💾 数据安全:
- 本地备份系统
- Git版本控制
- 远程同步机制

同步时间: 2026-03-30 16:25:35
系统状态: inkos正常运行中 (PID: 1433309)
创作进度: 第33章《油粮》创作中
2026-03-30 16:25:35 +08:00

131 lines
2.8 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Git 工作区设置脚本
# 用于初始化 Git 工作流程
set -e
echo "🚀 开始设置 Git 工作区..."
# 检查是否在 Git 仓库中
if [ ! -d .git ]; then
echo "❌ 当前目录不是 Git 仓库"
echo "正在初始化 Git 仓库..."
git init
fi
# 设置 Git 用户信息(如果未设置)
if [ -z "$(git config user.name)" ]; then
echo "📝 设置 Git 用户信息..."
git config user.name "唐天洛"
git config user.email "tianluo.tang@example.com"
fi
# 创建必要的目录
echo "📁 创建目录结构..."
mkdir -p scripts backups logs
# 添加 .gitignore如果不存在
if [ ! -f .gitignore ]; then
echo "📋 创建 .gitignore 文件..."
cat > .gitignore << 'EOF'
# 临时文件
*.tmp
*.temp
*.log
*.bak
*.swp
*~
# Python 缓存
__pycache__/
*.py[cod]
*$py.class
.Python
# 环境配置
.env
.venv
venv/
ENV/
env/
# 编辑器配置
.vscode/
.idea/
*.swp
*.swo
# 飞书同步缓存
feishu_sync_system/temp/
feishu_sync_system/backups/
*.feishu_backup
# 小说数据
novel-tracker/*.json
novel-tracker/*.lock
novel_sync_state.json
# 质量报告(保留主要报告,忽略临时报告)
quality_reports/
quality_report_ch*.json
# 小说章节备份
novel/backups/
novels/backups/
# 脚本生成的临时文件
*.sh.log
*.py.out
# 本地调试文件
/tmp/
/temp/
EOF
fi
# 设置 Git 别名
echo "⚡ 设置 Git 别名..."
git config alias.co checkout
git config alias.br branch
git config alias.ci commit
git config alias.st status
git config alias.unstage 'reset HEAD --'
git config alias.last 'log -1 HEAD'
git config alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# 创建提交信息模板
echo "📝 创建提交信息模板..."
cat > .gitmessage << 'EOF'
# <type>(<scope>): <subject>
# |<---- 使用最多 50 个字符 ---->|
#
# 解释为什么需要这个变更
# |<---- 尽量限制在 72 个字符内 ---->|
#
# 可选的 footer用于关闭 issue 或提供额外信息
# 例如: Closes #123, #456, #789
# 类型 (type):
# feat: 新功能
# fix: 修复 bug
# docs: 文档更新
# style: 代码格式调整
# refactor: 代码重构
# test: 测试相关
# chore: 构建过程或辅助工具的变动
# perf: 性能优化
# ci: CI/CD 配置
# 范围 (scope): 可选,可以是文件、目录或功能模块
EOF
git config commit.template .gitmessage
echo "✅ Git 工作区设置完成!"
echo ""
echo "📋 下一步操作建议:"
echo "1. 添加文件到暂存区: git add ."
echo "2. 提交初始版本: git commit -m 'feat(init): 初始化工作区'"
echo "3. 添加远程仓库: git remote add origin <your-repo-url>"
echo "4. 推送到远程: git push -u origin main"