跳转至

Git Commit Message Guide - Conventional Commits

General

所有项目都将采用 Conventional Commits 规范来书写提交信息。
每个项目将分别提供了一个 .gitmessage 模板文件,帮助团队成员快速书写符合规范的 commit message。

配置模板

在项目根目录下执行一次命令:

git config commit.template .gitmessage

之后每次运行 git commit 时,会自动加载该模板。
.gitmessage 模板文件位于项目根目录,用于统一团队提交规范。

提交格式

<type>(<scope>): <subject>
  • type:提交类型,如 feat、fix、chore、docs、test 等
  • scope:修改范围,如 main、renderer、theme、auth、deps
  • subject:简要描述修改内容,建议不超过 72 个字符

示例提交

1
2
3
4
5
feat(renderer): add dashboard page with user stats
fix(auth): resolve token refresh issue on session timeout
chore(theme): eject Chakra UI theme into src/renderer/src/theme
chore(config): add .gitmessage template for conventional commits
docs(readme): update setup instructions on Windows

Commit Message 速查表

常见 type

type 用途
feat 新功能(feature)
fix 修复 bug
docs 文档修改(README、注释等)
style 代码格式(不影响逻辑,例如缩进、空格、分号)
refactor 重构(既不是新增功能,也不是 bug 修复)
perf 性能优化
test 添加或修改测试
build 构建系统或依赖相关修改(Vite、Webpack、Electron Builder 等)
ci CI/CD 配置修改(GitLab CI、GitHub Actions 等)
chore 杂项(脚手架、配置文件、工具等,不影响业务逻辑)
revert 回滚某个提交

FinAI_Server

FinAI_App

推荐 scope

scope 用途
main Electron 主进程代码
renderer Electron 渲染进程 / React 前端代码
preload preload 脚本、contextBridge
auth 登录、鉴权、用户会话相关
ui 通用 UI 组件
theme 主题、样式、Chakra UI 配置
router 路由相关(TanStack Router 等)
state 状态管理(React Context、Redux、Zustand 等)
hooks 自定义 hooks
api API 客户端、接口封装
sdk 自动生成的 OpenAPI/Swagger SDK
deps 依赖相关修改
build 构建工具配置(Vite/Webpack/Electron Builder)
ci CI/CD 配置
config 配置文件(tsconfig、eslint、prettier 等)
scripts 脚本工具(bash、PowerShell、Node 脚本)

提交示例

1
2
3
4
5
feat(renderer): add settings page with dark mode support
fix(main): resolve crash when closing all windows
chore(theme): eject Chakra UI theme into src/renderer/src/theme
chore(config): add .gitmessage template for conventional commits
docs(readme): add commit message convention guide

参考

Conventional Commits 官方文档