Git代码提交规范
发布于 2026年8月4日 13:15👁 10
适用:个人项目 / 小团队协作
原则:一次提交只做一件事
一、提交格式
<类型>: <简短描述>
示例:
feat: 新增微信登录功能
fix: 修复套餐列表空白问题
docs: 更新部署文档
二、类型速查
类型什么时候用例子
feat加新功能 feat: 新增签名画布手写功能
fix修 Bug fix: 修复保存图片闪退问题
docs改文档 docs: 更新README步骤
refactor重构代码 refactor: 抽取公共组件
style改样式/格式 style: 调整按钮间距
chore杂项(配置/依赖等) chore: 更新go-pay依赖
三、常用提交(复制粘贴用)
功能开发
git commit -m "feat: 新增签名画布手写功能"
git commit -m "feat: 新增保存到相册功能"
git commit -m "feat: 新增笔触粗细调节"
git commit -m "feat: 新增颜色选择"
git commit -m "feat: 新增撤销功能"
git commit -m "feat: 新增签名历史列表"
git commit -m "feat: 新增删除签名功能"
git commit -m "feat: 新增分享给好友"
git commit -m "feat: 新增登录功能"
git commit -m "feat: 新增微信支付"
修复Bug
git commit -m "fix: 修复保存图片闪退问题"
git commit -m "fix: 修复画布颜色切换无效"
git commit -m "fix: 修复历史列表删除不刷新"
git commit -m "fix: 修复页面空白问题"
git commit -m "fix: 修复请求超时无提示"
git commit -m "fix: 修复按钮点击无响应"
文档
git commit -m "docs: 创建项目README"
git commit -m "docs: 添加需求文档"
git commit -m "docs: 更新部署步骤"
git commit -m "docs: 添加接口说明"
重构
git commit -m "refactor: 抽取签名画布为独立组件"
git commit -m "refactor: 统一错误处理"
git commit -m "refactor: 优化请求封装"
杂项
git commit -m "chore: 更新go-pay依赖版本"
git commit -m "chore: 配置国内代理"
git commit -m "chore: 添加eslint配置"
四、新手记住三条就够了
① feat = 加新功能
② fix = 修Bug
③ docs = 改文档
其他类型等你用熟了再了解。评论 (0)
还没有评论,来写第一条吧~