docs: 添加 starter 模板同步指南
This commit is contained in:
114
docs/sync-starter-template.md
Normal file
114
docs/sync-starter-template.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# 同步 Starter 模板更新指南
|
||||
|
||||
本文档说明如何从 `ai-assistant-starter` 仓库同步更新到当前项目。
|
||||
|
||||
## 🔄 工作流程
|
||||
|
||||
```
|
||||
ai-assistant-starter (模板仓库)
|
||||
↓ 更新
|
||||
feature/starter-sync (同步分支)
|
||||
↓ 合并
|
||||
main (主分支)
|
||||
```
|
||||
|
||||
## 📋 同步步骤
|
||||
|
||||
### 1. 查看同步分支的更新
|
||||
|
||||
```bash
|
||||
# 切换到同步分支
|
||||
git checkout feature/starter-sync
|
||||
|
||||
# 拉取 starter 仓库的最新更新
|
||||
git pull starter main
|
||||
```
|
||||
|
||||
### 2. 预览变更内容
|
||||
|
||||
```bash
|
||||
# 查看更新了哪些文件
|
||||
git log main..feature/starter-sync --oneline
|
||||
|
||||
# 查看具体变更内容
|
||||
git diff main..feature/starter-sync --stat
|
||||
```
|
||||
|
||||
### 3. 合并到主分支
|
||||
|
||||
```bash
|
||||
# 切换回主分支
|
||||
git checkout main
|
||||
|
||||
# 合并同步分支的更新
|
||||
git merge feature/starter-sync
|
||||
|
||||
# 如果有冲突,解决冲突后提交
|
||||
git add .
|
||||
git commit -m "chore: 同步 ai-assistant-starter 模板更新"
|
||||
```
|
||||
|
||||
### 4. 推送到远程仓库
|
||||
|
||||
```bash
|
||||
git push origin main
|
||||
```
|
||||
|
||||
## ⚠️ 注意事项
|
||||
|
||||
### 1. 保留项目特定文件
|
||||
|
||||
合并时可能会覆盖项目特定的配置文件(如 `CLAUDE.md`、`README.md`),需要:
|
||||
|
||||
```bash
|
||||
# 如果不小心覆盖了,可以从 main 分支恢复
|
||||
git checkout main -- CLAUDE.md README.md
|
||||
|
||||
# 然后重新编辑这些文件,保留项目特定的内容
|
||||
```
|
||||
|
||||
### 2. 冲突解决
|
||||
|
||||
如果合并时出现冲突:
|
||||
|
||||
```bash
|
||||
# 查看冲突文件
|
||||
git status
|
||||
|
||||
# 手动解决冲突后
|
||||
git add <解决冲突的文件>
|
||||
|
||||
# 完成合并
|
||||
git commit -m "chore: 合并 starter 更新并解决冲突"
|
||||
```
|
||||
|
||||
### 3. 定期同步
|
||||
|
||||
建议定期同步模板更新:
|
||||
|
||||
- **每周一次** - 检查 starter 仓库的更新
|
||||
- **重大更新** - 当 starter 仓库添加重要功能时
|
||||
- **创建新助手前** - 确保使用最新的模板
|
||||
|
||||
## 🚀 快速命令
|
||||
|
||||
```bash
|
||||
# 一键同步脚本
|
||||
git checkout feature/starter-sync && \
|
||||
git pull starter main && \
|
||||
git checkout main && \
|
||||
git merge feature/starter-sync -m "chore: 同步 starter 更新" && \
|
||||
git push origin main
|
||||
```
|
||||
|
||||
## 📊 分支说明
|
||||
|
||||
| 分支 | 跟踪仓库 | 用途 |
|
||||
|------|---------|------|
|
||||
| **main** | origin/main | 项目主分支,包含项目特定代码 |
|
||||
| **feature/starter-sync** | starter/main | 同步分支,跟踪 starter 模板仓库 |
|
||||
|
||||
---
|
||||
|
||||
**维护者**: d8dfun
|
||||
**最后更新**: 2026-03-28
|
||||
Reference in New Issue
Block a user