Last active
July 26, 2019 07:29
-
-
Save shenglinFL/a5e577e14b74c9321b5ad80732a893b1 to your computer and use it in GitHub Desktop.
git commit 模板
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<type>(<scope>): <subject> | |
<BLANK LINE> | |
<body> | |
<BLANK LINE> | |
<footer> | |
///////////////////// | |
Type | |
提交类型,必须是下列之一: | |
build:影响构建系统或外部依赖的改变 | |
ci:改变CI配置文件和脚本 | |
docs:只改变文档 | |
feat:一个新功能 | |
fix:一个bug fix | |
perf:代码更改,提高了性能 | |
refactor:代码重构 | |
style:不影响代码含义,只是代码风格的改变 | |
test:添加缺失的测试或修正现有的测试 | |
wip:移除文件或者代码 | |
Scope | |
scope应该是被影响的包的名称,这样能方便阅读根据提交信息生成的更新日志。 | |
比如,工具类的包名为Tools,本次提交为工具类里的修改,那么scope就为Tools: | |
feat(Tools): add a data utils | |
具体的scope根据项目中各模块的包名而定。 | |
subject | |
subject是 commit 目的的简短描述: | |
以动词开头,使用第一人称现在时,比如change,而不是changed或changes | |
第一个字母小写 | |
结尾不加句号(.) | |
Body | |
Body 部分是对本次 commit 的详细描述,可以分成多行。 | |
注意: | |
使用第一人称现在时,比如使用change而不是changed或changes。 | |
应该说明代码变动的动机,以及与以前行为的对比。 | |
Footer | |
Footer分两种情况: | |
不兼容变动:如果当前代码与上一个版本不兼容,则 Footer 部分以BREAKING CHANGE开头,后面是对变动的描述、以及变动理由和迁移方法。 | |
关闭 Issue:如果当前 commit 针对某个issue,那么可以在 Footer 部分关闭这个 issue 。 | |
Revert | |
还有一种特殊情况,如果当前 commit 用于撤销以前的 commit,则必须以revert:开头,后面跟着被撤销 Commit 的 Header。 | |
revert: feat(pencil): add 'graphiteWidth' option | |
This reverts commit 667ecc1654a317a13331b17617d973392f415f02. | |
Body部分的格式是固定的,必须写成This reverts commit <hash>.,其中的hash是被撤销 commit 的 SHA 标识符。 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment