Skip to content

septwong/git-commit-message

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Git Commit Message

Git 提交规范

Git commit

Commit message 包括三个部分:Header,Body 和 Footer。

Header 的格式比较特殊,包括三个字段:type(必需)、scope(可选)和subject(必需)。

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

Header 是必需的,Body 和 Footer 可以省略。

<type>(<scope>): <subject>
  │       │             │
  │       │             └─⫸ 主要描述,尽量简短
  │       │
  │       └─⫸ Commit Scope(可选): common | 业务模块[挂号 就诊人 用户子系统] 等等
  │
  └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test

git commit - m 'feat(common): util 中加入节流函数'
-m 参数 : 指定 commit message

示例:

docs(changelog): update changelog to beta.5
fix(release): need to depend on latest rxjs and zone.js

The version in our package.json gets copied to the one we publish, and users need the latest of these.

type

# 字符 文案 备注 颜色 规范
1 build 构建 对构建系统或外部依赖项进行了更改(示例范围:gulp、broccoli、npm) #d93f0b Angular
2 ci 持续集成 对 CI 配置文件和脚本进行了更改(示例范围:Travis、Circle、BrowserStack、SauceLabs) #c5def5 Angular
3 docs 文档注释 对文档进行了修改 #0075ca Angular
4 feat 功能 增加新的特征 #a2eeef Angular
5 fix 修复 修复 BUG #d73a4a Angular
6 perf 性能 提高性能的代码更改 #5319e7 Angular
7 refactor 重构 既不修复错误也不添加功能的代码更改 #006b75 Angular
8 style 样式 不影响代码含义的更改(空格、格式、缺少分号等) #5c879d Angular
9 test 测试 添加缺失的测试或更正现有的测试 #fbca04 Angular
- - - - - -
- chore 琐事 依赖项/修改脚手架配置等 #424242 -
- revert 撤销 撤消更改 #E91E63 -
- workflow 工作流 工作流程改进 #8BC34A -
- wip 开发中 开发中 #9E9E9E -
- types 类型定义 类型定义 #CE93D8 -
- release 发布 发布版本 #2ECC71 -
- opt 优化 优化业务代码 #FF9800 -

scope

可选: 没有统一的约定,一般提交时填写涉及的范围即可(公共模块 | 业务模块 )

subject

是 commit 目的的简短描述,不超过50个字符。

- 以动词开头,使用第一人称现在时,比如change,而不是changed或changes
- 第一个字母小写
- 结尾不加句号(.)

body

是对本次 commit 的详细描述,可以分成多行。

footer

  • 不兼容变动: BREAKING CHANGE: something.
  • 关闭 Issue: Closes #100, #101, #102

Git emoji

git commit -m ":tada: initialize Repo"

emoji emoji 代码 commit 说明
🎉 (庆祝) :tada: 初次提交
🆕 (全新) :new: 引入新功能
🔖 (书签) :bookmark: 发行/版本标签
🐛 (bug) :bug: 修复 bug
🚑 (急救车) :ambulance: 重要补丁
🌐 (地球) :globe_with_meridians: 国际化与本地化
💄 (口红) :lipstick: 更新 UI 和样式文件
🎬 (场记板) :clapper: 更新演示/示例
🚨 (警车灯) :rotating_light: 移除 linter 警告
🔧 (扳手) :wrench: 修改配置文件
➕ (加号) :heavy_plus_sign: 增加一个依赖
➖ (减号) :heavy_minus_sign: 减少一个依赖
⬆️ (上升箭头) :arrow_up: 升级依赖
⬇️ (下降箭头) :arrow_down: 降级依赖
⚡ (闪电)
🐎 (赛马)
:zap:
:racehorse:
提升性能
📈 (上升趋势图) :chart_with_upwards_trend: 添加分析或跟踪代码
🚀 (火箭) :rocket: 部署功能
✅ (白色复选框) :white_check_mark: 增加测试
📝 (备忘录)
📖 (书)
:memo:
:book:
撰写文档
🔨 (锤子) :hammer: 重大重构
🎨 (调色板) :art: 改进代码结构/代码格式
🔥 (火焰) :fire: 移除代码或文件
✏️ (铅笔) :pencil2: 修复 typo
🚧 (施工) :construction: 工作进行中
🗑️ (垃圾桶) :wastebasket: 废弃或删除
♿ (轮椅) :wheelchair: 可访问性
👷 (工人) :construction_worker: 添加 CI 构建系统
💚 (绿心) :green_heart: 修复 CI 构建问题
🔒 (锁) :lock: 修复安全问题
🐳 (鲸鱼) :whale: Docker 相关工作
🍎 (苹果) :apple: 修复 macOS 下的问题
🐧 (企鹅) :penguin: 修复 Linux 下的问题
🏁 (旗帜) :checkered_flag: 修复 Windows 下的问题
🔀 (交叉箭头) :twisted_rightwards_arrows: 分支合并

About

Git commit message and git emoji

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published