ai-engineering-init 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/skill-forced-eval.js +46 -62
- package/.claude/settings.json +10 -1
- package/.claude/skills/api-development/SKILL.md +179 -130
- package/.claude/skills/architecture-design/SKILL.md +102 -212
- package/.claude/skills/backend-annotations/SKILL.md +166 -220
- package/.claude/skills/bug-detective/SKILL.md +225 -186
- package/.claude/skills/code-patterns/SKILL.md +127 -244
- package/.claude/skills/collaborating-with-codex/SKILL.md +96 -113
- package/.claude/skills/crud-development/SKILL.md +226 -307
- package/.claude/skills/data-permission/SKILL.md +131 -202
- package/.claude/skills/database-ops/SKILL.md +158 -355
- package/.claude/skills/error-handler/SKILL.md +224 -285
- package/.claude/skills/file-oss-management/SKILL.md +174 -169
- package/.claude/skills/git-workflow/SKILL.md +123 -341
- package/.claude/skills/json-serialization/SKILL.md +121 -137
- package/.claude/skills/performance-doctor/SKILL.md +83 -89
- package/.claude/skills/redis-cache/SKILL.md +134 -185
- package/.claude/skills/scheduled-jobs/SKILL.md +187 -224
- package/.claude/skills/security-guard/SKILL.md +168 -276
- package/.claude/skills/sms-mail/SKILL.md +266 -228
- package/.claude/skills/social-login/SKILL.md +257 -195
- package/.claude/skills/tenant-management/SKILL.md +172 -188
- package/.claude/skills/utils-toolkit/SKILL.md +214 -222
- package/.claude/skills/websocket-sse/SKILL.md +251 -172
- package/.claude/skills/workflow-engine/SKILL.md +178 -250
- package/.codex/skills/api-development/SKILL.md +179 -130
- package/.codex/skills/architecture-design/SKILL.md +102 -212
- package/.codex/skills/backend-annotations/SKILL.md +166 -220
- package/.codex/skills/bug-detective/SKILL.md +225 -186
- package/.codex/skills/code-patterns/SKILL.md +127 -244
- package/.codex/skills/collaborating-with-codex/SKILL.md +96 -113
- package/.codex/skills/crud-development/SKILL.md +226 -307
- package/.codex/skills/data-permission/SKILL.md +131 -202
- package/.codex/skills/database-ops/SKILL.md +158 -355
- package/.codex/skills/error-handler/SKILL.md +224 -285
- package/.codex/skills/file-oss-management/SKILL.md +174 -169
- package/.codex/skills/git-workflow/SKILL.md +123 -341
- package/.codex/skills/json-serialization/SKILL.md +121 -137
- package/.codex/skills/performance-doctor/SKILL.md +83 -89
- package/.codex/skills/redis-cache/SKILL.md +134 -185
- package/.codex/skills/scheduled-jobs/SKILL.md +187 -224
- package/.codex/skills/security-guard/SKILL.md +168 -276
- package/.codex/skills/sms-mail/SKILL.md +266 -228
- package/.codex/skills/social-login/SKILL.md +257 -195
- package/.codex/skills/tenant-management/SKILL.md +172 -188
- package/.codex/skills/utils-toolkit/SKILL.md +214 -222
- package/.codex/skills/websocket-sse/SKILL.md +251 -172
- package/.codex/skills/workflow-engine/SKILL.md +178 -250
- package/.cursor/hooks/cursor-skill-eval.js +66 -6
- package/.cursor/skills/api-development/SKILL.md +179 -130
- package/.cursor/skills/architecture-design/SKILL.md +102 -212
- package/.cursor/skills/backend-annotations/SKILL.md +166 -220
- package/.cursor/skills/bug-detective/SKILL.md +225 -186
- package/.cursor/skills/code-patterns/SKILL.md +127 -244
- package/.cursor/skills/collaborating-with-codex/SKILL.md +96 -113
- package/.cursor/skills/crud-development/SKILL.md +226 -307
- package/.cursor/skills/data-permission/SKILL.md +131 -202
- package/.cursor/skills/database-ops/SKILL.md +158 -355
- package/.cursor/skills/error-handler/SKILL.md +224 -285
- package/.cursor/skills/file-oss-management/SKILL.md +174 -169
- package/.cursor/skills/git-workflow/SKILL.md +123 -341
- package/.cursor/skills/json-serialization/SKILL.md +121 -137
- package/.cursor/skills/performance-doctor/SKILL.md +83 -89
- package/.cursor/skills/redis-cache/SKILL.md +134 -185
- package/.cursor/skills/scheduled-jobs/SKILL.md +187 -224
- package/.cursor/skills/security-guard/SKILL.md +168 -276
- package/.cursor/skills/sms-mail/SKILL.md +266 -228
- package/.cursor/skills/social-login/SKILL.md +257 -195
- package/.cursor/skills/tenant-management/SKILL.md +172 -188
- package/.cursor/skills/utils-toolkit/SKILL.md +214 -222
- package/.cursor/skills/websocket-sse/SKILL.md +251 -172
- package/.cursor/skills/workflow-engine/SKILL.md +178 -250
- package/AGENTS.md +49 -540
- package/CLAUDE.md +73 -119
- package/README.md +37 -6
- package/bin/index.js +5 -1
- package/package.json +1 -1
- package/src/skills/api-development/SKILL.md +179 -130
- package/src/skills/architecture-design/SKILL.md +102 -212
- package/src/skills/backend-annotations/SKILL.md +166 -220
- package/src/skills/bug-detective/SKILL.md +225 -186
- package/src/skills/code-patterns/SKILL.md +127 -244
- package/src/skills/collaborating-with-codex/SKILL.md +96 -113
- package/src/skills/crud-development/SKILL.md +226 -307
- package/src/skills/data-permission/SKILL.md +131 -202
- package/src/skills/database-ops/SKILL.md +158 -355
- package/src/skills/error-handler/SKILL.md +224 -285
- package/src/skills/file-oss-management/SKILL.md +174 -169
- package/src/skills/git-workflow/SKILL.md +123 -341
- package/src/skills/json-serialization/SKILL.md +121 -137
- package/src/skills/performance-doctor/SKILL.md +83 -89
- package/src/skills/redis-cache/SKILL.md +134 -185
- package/src/skills/scheduled-jobs/SKILL.md +187 -224
- package/src/skills/security-guard/SKILL.md +168 -276
- package/src/skills/sms-mail/SKILL.md +266 -228
- package/src/skills/social-login/SKILL.md +257 -195
- package/src/skills/tenant-management/SKILL.md +172 -188
- package/src/skills/utils-toolkit/SKILL.md +214 -222
- package/src/skills/websocket-sse/SKILL.md +251 -172
- package/src/skills/workflow-engine/SKILL.md +178 -250
- package/.claude/skills/skill-creator/LICENSE.txt +0 -202
- package/.claude/skills/skill-creator/SKILL.md +0 -479
- package/.claude/skills/skill-creator/agents/analyzer.md +0 -274
- package/.claude/skills/skill-creator/agents/comparator.md +0 -202
- package/.claude/skills/skill-creator/agents/grader.md +0 -223
- package/.claude/skills/skill-creator/assets/eval_review.html +0 -146
- package/.claude/skills/skill-creator/eval-viewer/generate_review.py +0 -471
- package/.claude/skills/skill-creator/eval-viewer/viewer.html +0 -1325
- package/.claude/skills/skill-creator/references/schemas.md +0 -430
- package/.claude/skills/skill-creator/scripts/__init__.py +0 -0
- package/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
- package/.claude/skills/skill-creator/scripts/generate_report.py +0 -326
- package/.claude/skills/skill-creator/scripts/improve_description.py +0 -248
- package/.claude/skills/skill-creator/scripts/package_skill.py +0 -136
- package/.claude/skills/skill-creator/scripts/quick_validate.py +0 -103
- package/.claude/skills/skill-creator/scripts/run_eval.py +0 -310
- package/.claude/skills/skill-creator/scripts/run_loop.py +0 -332
- package/.claude/skills/skill-creator/scripts/utils.py +0 -47
|
@@ -1,397 +1,179 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: git-workflow
|
|
3
3
|
description: |
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
- 创建/合并分支
|
|
9
|
-
- 查看提交历史
|
|
10
|
-
- 解决冲突
|
|
11
|
-
- 回滚代码
|
|
12
|
-
|
|
13
|
-
触发词:git、提交、commit、分支、合并、push、pull、冲突、回滚、版本、历史
|
|
4
|
+
通用 Git 工作流指南。涵盖分支策略、提交规范、PR 流程、冲突解决等。
|
|
5
|
+
触发场景:Git 操作、分支管理、提交规范、代码合并。
|
|
6
|
+
触发词:Git、分支、提交、合并、rebase、PR。
|
|
7
|
+
注意:如果项目有专属技能(如 `leniu-git-workflow`),优先使用专属版本。
|
|
14
8
|
---
|
|
15
9
|
|
|
16
10
|
# Git 工作流指南
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
> 通用模板。如果项目有专属技能(如 `leniu-git-workflow`),优先使用。
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
## 核心规范
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
2. **不提交配置文件**:排除 `.env*`、`application*.yml` 等配置
|
|
24
|
-
3. **默认只提交到本地**:执行 `git add` + `git commit`,**不自动 push**
|
|
25
|
-
4. **明确指定才推送**:只有用户明确说"推送"、"push"、"提交到远程"时才执行 `git push`
|
|
26
|
-
|
|
27
|
-
### 提交信息格式
|
|
16
|
+
### 分支策略(Git Flow)
|
|
28
17
|
|
|
29
18
|
```
|
|
30
|
-
|
|
19
|
+
main (production)
|
|
20
|
+
│
|
|
21
|
+
├── hotfix/fix-payment-bug ← 紧急修复,从 main 拉出
|
|
22
|
+
│
|
|
23
|
+
develop (integration)
|
|
24
|
+
│
|
|
25
|
+
├── feature/order-export ← 功能开发,从 develop 拉出
|
|
26
|
+
├── feature/user-profile ← 并行开发
|
|
27
|
+
│
|
|
28
|
+
└── release/v1.2.0 ← 发布准备,从 develop 拉出
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# 修复 Bug
|
|
42
|
-
fix(demo): 修复订单状态显示错误
|
|
43
|
-
|
|
44
|
-
# 文档更新
|
|
45
|
-
docs(readme): 更新安装说明
|
|
46
|
-
|
|
47
|
-
# 重构
|
|
48
|
-
refactor(common): 重构分页查询工具类
|
|
49
|
-
|
|
50
|
-
# 性能优化
|
|
51
|
-
perf(system): 优化用户列表查询性能
|
|
52
|
-
|
|
53
|
-
# 测试
|
|
54
|
-
test(demo): 添加单元测试
|
|
55
|
-
```
|
|
31
|
+
| 分支类型 | 来源 | 合并目标 | 命名 |
|
|
32
|
+
|---------|------|---------|------|
|
|
33
|
+
| `main` | - | - | `main` |
|
|
34
|
+
| `develop` | `main` | `main` | `develop` |
|
|
35
|
+
| `feature/*` | `develop` | `develop` | `feature/功能描述` |
|
|
36
|
+
| `release/*` | `develop` | `main` + `develop` | `release/v1.x.x` |
|
|
37
|
+
| `hotfix/*` | `main` | `main` + `develop` | `hotfix/问题描述` |
|
|
56
38
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# 1. 查看当前改动
|
|
61
|
-
git status
|
|
62
|
-
|
|
63
|
-
# 2. 只添加当前会话修改的业务文件(排除配置)
|
|
64
|
-
git add ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/xxx/
|
|
65
|
-
# 或者添加具体文件
|
|
66
|
-
git add path/to/file1.java path/to/file2.java
|
|
67
|
-
|
|
68
|
-
# 3. 提交到本地(不 push!)
|
|
69
|
-
git commit -m "feat(system): 新增xxx功能"
|
|
70
|
-
|
|
71
|
-
# 4. 只有用户明确要求时才推送
|
|
72
|
-
# git push # ← 用户说"推送"时才执行
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### 不要提交的文件
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# ❌ 团队项目配置文件(绝对不提交,包含数据库/中间件/环境信息)
|
|
79
|
-
core-base/src/main/resources/bootstrap.yml
|
|
80
|
-
core-base/src/main/resources/bootstrap-dev.yml
|
|
81
|
-
core-base/src/main/resources/ConfigSource.properties
|
|
82
|
-
core-base/src/main/resources/license.dat
|
|
83
|
-
core-base/src/main/resources/logback-spring.xml
|
|
84
|
-
core-base/src/main/resources/message_*.properties
|
|
85
|
-
|
|
86
|
-
# ❌ 通用配置文件(绝对不提交)
|
|
87
|
-
ruoyi-admin/src/main/resources/application.yml
|
|
88
|
-
ruoyi-admin/src/main/resources/application-*.yml
|
|
89
|
-
ruoyi-common/**/resources/*.yml
|
|
90
|
-
|
|
91
|
-
# ❌ 测试/迁移基础设施文件(包含本地数据源配置,不提交)
|
|
92
|
-
**/WebMvcTestConfig.java
|
|
93
|
-
**/DataSourceMigration.java
|
|
94
|
-
|
|
95
|
-
# ❌ IDE 配置
|
|
96
|
-
.idea/
|
|
97
|
-
.vscode/
|
|
98
|
-
*.iml
|
|
39
|
+
### 简化策略(GitHub Flow,适合小团队)
|
|
99
40
|
|
|
100
|
-
# ❌ 本地临时文件
|
|
101
|
-
*.log
|
|
102
|
-
target/
|
|
103
|
-
logs/
|
|
104
41
|
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
| 类型 | 说明 | 示例 |
|
|
111
|
-
|------|------|------|
|
|
112
|
-
| feat | 新功能 | `feat(system): 新增用户反馈功能` |
|
|
113
|
-
| fix | 修复Bug | `fix(demo): 修复订单状态显示错误` |
|
|
114
|
-
| docs | 文档更新 | `docs(readme): 更新安装说明` |
|
|
115
|
-
| style | 代码格式 | `style(system): 格式化代码` |
|
|
116
|
-
| refactor | 重构 | `refactor(common): 重构用户模块` |
|
|
117
|
-
| perf | 性能优化 | `perf(system): 优化查询性能` |
|
|
118
|
-
| test | 测试 | `test(demo): 添加单元测试` |
|
|
119
|
-
| chore | 构建/工具 | `chore: 更新依赖` |
|
|
120
|
-
|
|
121
|
-
### scope 常用范围
|
|
122
|
-
|
|
123
|
-
| scope | 说明 | 对应模块 |
|
|
124
|
-
|-------|------|----------|
|
|
125
|
-
| system | 系统管理 | `ruoyi-modules/ruoyi-system/` |
|
|
126
|
-
| demo | 演示模块 | `ruoyi-modules/ruoyi-demo/` |
|
|
127
|
-
| workflow | 工作流 | `ruoyi-modules/ruoyi-workflow/` |
|
|
128
|
-
| job | 定时任务 | `ruoyi-modules/ruoyi-job/` |
|
|
129
|
-
| generator | 代码生成 | `ruoyi-modules/ruoyi-generator/` |
|
|
130
|
-
| common | 通用模块 | `ruoyi-common/` |
|
|
131
|
-
| admin | 启动模块 | `ruoyi-admin/` |
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## 常用命令
|
|
136
|
-
|
|
137
|
-
### 基础操作
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# 查看状态
|
|
141
|
-
git status
|
|
142
|
-
|
|
143
|
-
# 查看改动
|
|
144
|
-
git diff
|
|
145
|
-
git diff --staged # 已暂存的改动
|
|
146
|
-
|
|
147
|
-
# 添加文件
|
|
148
|
-
git add . # 添加所有(谨慎使用!)
|
|
149
|
-
git add <file> # 添加指定文件(推荐)
|
|
150
|
-
|
|
151
|
-
# 提交
|
|
152
|
-
git commit -m "提交信息"
|
|
153
|
-
|
|
154
|
-
# 推送(需用户明确要求)
|
|
155
|
-
git push
|
|
156
|
-
git push -u origin <branch> # 首次推送并设置上游
|
|
42
|
+
main
|
|
43
|
+
├── feature/order-export
|
|
44
|
+
├── fix/login-error
|
|
45
|
+
└── chore/upgrade-deps
|
|
157
46
|
```
|
|
158
47
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
# 查看分支
|
|
163
|
-
git branch # 本地分支
|
|
164
|
-
git branch -r # 远程分支
|
|
165
|
-
git branch -a # 所有分支
|
|
166
|
-
|
|
167
|
-
# 创建分支
|
|
168
|
-
git branch <name>
|
|
169
|
-
git checkout -b <name> # 创建并切换
|
|
170
|
-
|
|
171
|
-
# 切换分支
|
|
172
|
-
git checkout <name>
|
|
173
|
-
git switch <name>
|
|
48
|
+
- 只有 `main` 一个长期分支
|
|
49
|
+
- 所有开发从 `main` 拉分支,完成后通过 PR 合并回 `main`
|
|
174
50
|
|
|
175
|
-
|
|
176
|
-
git merge <name>
|
|
51
|
+
### 提交规范(Conventional Commits)
|
|
177
52
|
|
|
178
|
-
# 删除分支
|
|
179
|
-
git branch -d <name> # 删除本地
|
|
180
|
-
git push origin -d <name> # 删除远程
|
|
181
53
|
```
|
|
182
|
-
|
|
183
|
-
### 历史查看
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
# 查看提交历史
|
|
187
|
-
git log
|
|
188
|
-
git log --oneline
|
|
189
|
-
git log --oneline -10 # 最近10条
|
|
190
|
-
|
|
191
|
-
# 查看某文件历史
|
|
192
|
-
git log --follow <file>
|
|
193
|
-
|
|
194
|
-
# 查看某次提交的内容
|
|
195
|
-
git show <commit-id>
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### 撤销操作
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# 撤销工作区修改
|
|
202
|
-
git checkout -- <file>
|
|
203
|
-
git restore <file>
|
|
204
|
-
|
|
205
|
-
# 撤销暂存
|
|
206
|
-
git reset HEAD <file>
|
|
207
|
-
git restore --staged <file>
|
|
208
|
-
|
|
209
|
-
# 撤销提交(保留修改)
|
|
210
|
-
git reset --soft HEAD^
|
|
211
|
-
|
|
212
|
-
# 撤销提交(丢弃修改)
|
|
213
|
-
git reset --hard HEAD^
|
|
214
|
-
|
|
215
|
-
# 回滚到某个提交
|
|
216
|
-
git reset --hard <commit-id>
|
|
54
|
+
<type>(<scope>): <subject>
|
|
217
55
|
```
|
|
218
56
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
## 分支策略
|
|
222
|
-
|
|
223
|
-
### 主要分支
|
|
224
|
-
|
|
225
|
-
| 分支 | 用途 | 说明 |
|
|
57
|
+
| type | 说明 | 示例 |
|
|
226
58
|
|------|------|------|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
# 1. 从 dev 创建功能分支
|
|
237
|
-
git checkout dev
|
|
238
|
-
git pull
|
|
239
|
-
git checkout -b feature/user-feedback
|
|
240
|
-
|
|
241
|
-
# 2. 开发并提交(只提交当前会话改动的业务文件)
|
|
242
|
-
git add ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/feedback/
|
|
243
|
-
git commit -m "feat(system): 新增用户反馈功能"
|
|
59
|
+
| `feat` | 新功能 | `feat(order): 新增订单导出` |
|
|
60
|
+
| `fix` | 修复 Bug | `fix(auth): 修复 token 过期未刷新` |
|
|
61
|
+
| `docs` | 文档 | `docs: 更新 API 文档` |
|
|
62
|
+
| `style` | 格式 | `style: 统一缩进为 4 空格` |
|
|
63
|
+
| `refactor` | 重构 | `refactor(user): 拆分用户服务` |
|
|
64
|
+
| `perf` | 性能 | `perf(query): 优化列表查询 N+1` |
|
|
65
|
+
| `test` | 测试 | `test(order): 补充订单创建单测` |
|
|
66
|
+
| `chore` | 构建/工具 | `chore: 升级 Spring Boot 3.2` |
|
|
67
|
+
| `ci` | CI/CD | `ci: 添加 GitHub Actions 流水线` |
|
|
244
68
|
|
|
245
|
-
|
|
246
|
-
|
|
69
|
+
**规则**:
|
|
70
|
+
- subject 使用中文或英文,但全项目统一
|
|
71
|
+
- 不超过 72 字符
|
|
72
|
+
- 不以句号结尾
|
|
73
|
+
- 使用祈使语气("添加"而非"添加了")
|
|
247
74
|
|
|
248
|
-
|
|
75
|
+
### 提交行为规范
|
|
249
76
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
git
|
|
253
|
-
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
---
|
|
77
|
+
1. **只提交当前会话的改动**:精确 `git add` 修改的文件,不要 `git add .`
|
|
78
|
+
2. **不提交配置文件**:排除 `.env*`、`application-*.yml` 等环境配置
|
|
79
|
+
3. **默认只提交到本地**:执行 `git add` + `git commit`,不自动 push
|
|
80
|
+
4. **明确指定才推送**:只有用户明确说"推送"、"push"时才执行 `git push`
|
|
257
81
|
|
|
258
|
-
##
|
|
82
|
+
## 代码示例
|
|
259
83
|
|
|
260
|
-
###
|
|
84
|
+
### 常用 Git 操作
|
|
261
85
|
|
|
262
86
|
```bash
|
|
263
|
-
#
|
|
264
|
-
git
|
|
87
|
+
# 创建功能分支
|
|
88
|
+
git checkout develop
|
|
89
|
+
git pull origin develop
|
|
90
|
+
git checkout -b feature/order-export
|
|
265
91
|
|
|
266
|
-
#
|
|
267
|
-
|
|
268
|
-
|
|
92
|
+
# 开发完成,合并前更新
|
|
93
|
+
git fetch origin
|
|
94
|
+
git rebase origin/develop
|
|
269
95
|
|
|
270
|
-
#
|
|
271
|
-
# <<<<<<< HEAD
|
|
272
|
-
# 当前分支的代码
|
|
273
|
-
# =======
|
|
274
|
-
# 要合并的代码
|
|
275
|
-
# >>>>>>> feature/xxx
|
|
276
|
-
|
|
277
|
-
# 4. 解决后添加并提交
|
|
278
|
-
git add .
|
|
279
|
-
git commit -m "fix: 解决合并冲突"
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### 变基冲突
|
|
283
|
-
|
|
284
|
-
```bash
|
|
285
|
-
# 1. 变基
|
|
286
|
-
git rebase dev
|
|
287
|
-
|
|
288
|
-
# 2. 如果有冲突,解决后
|
|
96
|
+
# 解决冲突后继续
|
|
289
97
|
git add .
|
|
290
98
|
git rebase --continue
|
|
291
99
|
|
|
292
|
-
#
|
|
293
|
-
git
|
|
100
|
+
# 推送并创建 PR
|
|
101
|
+
git push -u origin feature/order-export
|
|
102
|
+
gh pr create --base develop --title "feat(order): 新增订单导出功能"
|
|
294
103
|
```
|
|
295
104
|
|
|
296
|
-
|
|
105
|
+
### 常用 Git 修复操作
|
|
297
106
|
|
|
298
|
-
|
|
107
|
+
```bash
|
|
108
|
+
# 修改最后一次提交信息
|
|
109
|
+
git commit --amend -m "fix(order): 修复订单金额计算"
|
|
299
110
|
|
|
300
|
-
|
|
111
|
+
# 撤销最后一次提交(保留修改)
|
|
112
|
+
git reset --soft HEAD~1
|
|
301
113
|
|
|
302
|
-
```bash
|
|
303
114
|
# 暂存当前修改
|
|
304
115
|
git stash
|
|
116
|
+
git stash pop
|
|
305
117
|
|
|
306
|
-
#
|
|
307
|
-
git
|
|
308
|
-
|
|
309
|
-
# 恢复暂存
|
|
310
|
-
git stash pop # 恢复并删除
|
|
311
|
-
git stash apply # 恢复但保留
|
|
118
|
+
# 挑选某个提交到当前分支
|
|
119
|
+
git cherry-pick <commit-hash>
|
|
312
120
|
|
|
313
|
-
#
|
|
314
|
-
git
|
|
315
|
-
git stash clear # 清空所有
|
|
121
|
+
# 查看某个文件的修改历史
|
|
122
|
+
git log --oneline -20 -- path/to/file
|
|
316
123
|
```
|
|
317
124
|
|
|
318
|
-
###
|
|
125
|
+
### PR / Code Review 规范
|
|
319
126
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
127
|
+
1. **PR 大小**:单个 PR 不超过 400 行变更(不含自动生成代码)
|
|
128
|
+
2. **PR 描述**:说明改了什么、为什么改、如何测试
|
|
129
|
+
3. **自查清单**:
|
|
130
|
+
- [ ] 代码能编译通过
|
|
131
|
+
- [ ] 新功能有对应测试
|
|
132
|
+
- [ ] 没有遗留 TODO / 调试代码
|
|
133
|
+
- [ ] 数据库变更有迁移脚本
|
|
134
|
+
4. **Review 要点**:
|
|
135
|
+
- 逻辑正确性 > 代码风格
|
|
136
|
+
- 关注边界条件和异常处理
|
|
137
|
+
- 检查安全隐患(SQL 注入、XSS 等)
|
|
323
138
|
|
|
324
|
-
|
|
325
|
-
git add .
|
|
326
|
-
git commit --amend --no-edit
|
|
327
|
-
```
|
|
139
|
+
### .gitignore 推荐配置
|
|
328
140
|
|
|
329
|
-
|
|
141
|
+
```gitignore
|
|
142
|
+
# IDE
|
|
143
|
+
.idea/
|
|
144
|
+
*.iml
|
|
145
|
+
.vscode/
|
|
146
|
+
*.swp
|
|
330
147
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
148
|
+
# Build
|
|
149
|
+
target/
|
|
150
|
+
build/
|
|
151
|
+
dist/
|
|
152
|
+
node_modules/
|
|
335
153
|
|
|
336
|
-
|
|
154
|
+
# Environment
|
|
155
|
+
.env
|
|
156
|
+
.env.local
|
|
157
|
+
*.local
|
|
337
158
|
|
|
338
|
-
|
|
339
|
-
|
|
159
|
+
# OS
|
|
160
|
+
.DS_Store
|
|
161
|
+
Thumbs.db
|
|
162
|
+
|
|
163
|
+
# Logs
|
|
164
|
+
*.log
|
|
165
|
+
logs/
|
|
340
166
|
```
|
|
341
167
|
|
|
342
|
-
|
|
168
|
+
## 常见错误
|
|
343
169
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
2. **不要在主分支直接开发**
|
|
356
|
-
```bash
|
|
357
|
-
# ❌ 禁止(团队主分支为 master,不在此分支直接提交)
|
|
358
|
-
git checkout master
|
|
359
|
-
# 直接修改代码...
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
3. **不要提交敏感信息和配置文件**
|
|
363
|
-
```bash
|
|
364
|
-
# ❌ 禁止提交
|
|
365
|
-
application.yml
|
|
366
|
-
application-dev.yml
|
|
367
|
-
application-prod.yml
|
|
368
|
-
bootstrap.yml
|
|
369
|
-
bootstrap-dev.yml
|
|
370
|
-
ConfigSource.properties
|
|
371
|
-
license.dat
|
|
372
|
-
logback-spring.xml
|
|
373
|
-
message_*.properties
|
|
374
|
-
credentials.json
|
|
375
|
-
password.txt
|
|
376
|
-
# ❌ 禁止提交(包含本地数据源/测试环境配置)
|
|
377
|
-
WebMvcTestConfig.java
|
|
378
|
-
DataSourceMigration.java
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
4. **不要自动 push(除非用户明确要求)**
|
|
382
|
-
```bash
|
|
383
|
-
# ❌ 默认不执行
|
|
384
|
-
git push
|
|
385
|
-
|
|
386
|
-
# ✅ 只有用户说"推送到远程"时才执行
|
|
387
|
-
git push
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
### 最佳实践
|
|
391
|
-
|
|
392
|
-
1. **只提交当前会话改动**:不要 `git add .`,精确添加修改的文件
|
|
393
|
-
2. **排除配置文件**:配置文件包含本地环境信息,不应提交
|
|
394
|
-
3. **清晰的提交信息**:包含类型 + 范围 + 描述
|
|
395
|
-
4. **默认只本地提交**:`git add` + `git commit`,不自动 push
|
|
396
|
-
5. **频繁小步提交**:便于追踪和回滚
|
|
397
|
-
6. **Code Review**:通过 PR 合并代码
|
|
170
|
+
| 错误 | 正确做法 |
|
|
171
|
+
|------|---------|
|
|
172
|
+
| 直接在 main 上开发 | 创建功能分支 |
|
|
173
|
+
| 提交信息写"update"、"fix bug" | 按 Conventional Commits 规范 |
|
|
174
|
+
| 一个 PR 包含多个不相关改动 | 拆分为多个 PR |
|
|
175
|
+
| `git push --force` 到公共分支 | 只对个人分支 force push |
|
|
176
|
+
| 提交 .env、密钥文件 | 加入 .gitignore |
|
|
177
|
+
| merge 前不更新目标分支 | 先 rebase/merge 最新代码 |
|
|
178
|
+
| 忽略 CI 失败直接合并 | 修复 CI 后再合并 |
|
|
179
|
+
| `git add .` 一把梭 | 精确添加修改的业务文件 |
|