一个统一的commit消息模板可以约束团队成员使用一致的方式提交变更信息,这样也方便集成工具进行合规检查。

通常来讲,commit信息应该包含如下内容:

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

type表示commit类型,可选值如下:

1.feat: A new feature

2.fix: A bug fix

3.docs: Documentation only changes

4.style: Changes that do not affect the meaning of the code (white-space, formatting, etc)

5.refactor: A code change that neither fixes a bug nor adds a feature

6.perf: A code change that improves performance

7.test: Adding missing tests or correcting existing tests

8.build: Changes that affect the build system or external dependencies (e.g: gulp, npm)

9.ci:Changes to our CI configuration files and scripts (e.g: Travis, Circle, BrowserStack)

10.chore: Other changes that don’t modify src or test files

11.revert: Reverts a previous commit

scope表示影响范围,如:route, component, utils, build等

subject表示commit概述,建议符合50/72 formatting

body表示具体修改的内容,可以分为多行,每一行建议符合50/72 formatting

footer是一些备注信息, 通常是BREAKING CHANGE或修复的BUG链接,如:issue #123

变更消息模板可以通过文件的方式固话下来,这样在每次提交变更的时候参照模板填写对应的信息。

一个完整的模板内容如下:


# head: <type>(<scope>): <subject>
# - type: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
# - scope: can be empty (eg. if the change is a global or difficult to assign to a single component), e.g: route, component, utils, build...
# - subject: start with verb (such as 'change'), 50-character line
#
# body: 72-character wrapped. Multiple lines separated by “-”, This should answer:
# * Why was this change necessary?
# * How does it address the problem?
# * Are there any side effects?
#
# footer:
# - Include a link to the ticket, if any.
# - BREAKING CHANGE
#
# e.g:
# <type>(<scope>): <subject>
# <BLANK LINE>
# <body>
# <BLANK LINE>
# <footer>
#
# types:
#
# feat: A new feature
# fix: A bug fix
# docs: Documentation only changes
# style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
# refactor: A code change that neither fixes a bug nor adds a feature
# perf: A code change that improves performance
# test: Adding missing tests or correcting existing tests
# build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
# ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
# chore: Other changes that don't modify src or test files
# revert: Reverts a previous commit

可以将上述模板信息保存在文件"~/.gitmessage "中并添加为git的commit模板:

修改 ~/.gitconfig,添加:

[commit]
template = ~/.gitmessage

一个Git Commit Message模板的更多相关文章

  1. 如何写好git commit message

    1.触发事件 我有这样一个版本库,里面包含两个学习用的练习项目:BookStore(以下简称BS)和PictureFriend(以下简称PF) 我在更改PF以后,未进行提交,同时又到BS中优化了一下文 ...

  2. git第四节----git commit message

    @git  commit message 什么是git commit message :git commit -m '每次提交时编辑的内容' git commit message的好处:      1 ...

  3. Git Commit Message 规范

    今天来说说团队开发中,对于 Git commit message 规范问题. 社区上有各种 Commit message 的规范,本文介绍 Angular 规范,目前使用较广,比较合理和系统化,并且有 ...

  4. 我是怎么写 Git Commit message 的?

    目录 作用 用的什么规范? type scope subject body footer 参考文章 用的什么辅助工具? 作用 编写格式化的 commit message 能够大大提高代码的维护效率. ...

  5. Git Commit Message 应该怎么写?

    原文链接: Git Commit Message 应该怎么写? 最近被同事吐槽了,说我代码提交说明写的太差.其实都不用他吐槽,我自己心里也非常清楚.毕竟很多时候犯懒,都是直接一个 -m "f ...

  6. [译]How to Write a Git Commit Message

    原文: http://chris.beams.io/posts/git-commit/ 介绍:为什么好的commit message很重要 你浏览项目commit message的时候或多或少会有些困 ...

  7. Git commit template 模板设定

    多人协作开发一个项目时,版本控制工具是少不了的,git是linux 内核开发时引入的一个优秀代码管理工具,利用它能很好使团队协作完成一个项目.为了规范团队的代码提交,也方便出版本时的release n ...

  8. Git commit message和工作流规范

    目的 统一团队Git commit日志标准,便于后续代码review,版本发布以及日志自动化生成等等. 统一团队的Git工作流,包括分支使用.tag规范.issue等 Git commit日志参考案例 ...

  9. git使用总结(包含git commit message 和 changelog 工具的介绍)

    [git的配置] 1.配置用户名和邮箱: 分为全局配置和局部配置 --system 系统配置  --global 全局配置    --local 局部配置 Git读取时:优先从local>glo ...

  10. commitizen和cz-customizable配置git commit message

    起因 团队对提交的commit message格式有约定俗称的要求,但是没有一个统一的规范,导致大家提交的commit message或多或少不太一样.因此,需要一个工具来帮助大家统一commit m ...

随机推荐

  1. [转帖]Linux禁用CPU省电状态/Linux系统性能调优

    https://www.jianshu.com/p/945168b47487 How to Disable CPU Power Saving States on a Redhat or Suse Li ...

  2. 在线安装gfortran的方法-CentOS8 or 阿里龙蜥

    在线安装gfortran的方法-CentOS8 or 阿里龙蜥 背景 在阿里云上面进行了 speccpu2006的测试验证 但是发现总是很多包安装不过去 原因是阿里最小化安装的龙蜥系统. 缺少很多编译 ...

  3. [转帖]01-rsync备份方式

    https://developer.aliyun.com/article/885783?spm=a2c6h.24874632.expert-profile.284.7c46cfe9h5DxWK 简介: ...

  4. 如何查看服务器的Raid缓存等配置的情况

    摘要 最近总遇到同一批机器的IO不一样的情况. 感觉可能跟硬件设备和Raid卡的设置不一样有关系. 所以今天学习研究了下storcli的命令. 希望能够进行一些数据的收集. Storcli简介 sto ...

  5. 【转贴】java 进程运行状态图解

    java 进程运行状态图解   原文博客地址 https://www.cnblogs.com/GooPolaris/p/8079490.html java中进程的状态有 6 种: NEW(新建).RU ...

  6. 买彩票能中大奖?用Java盘点常见的概率悖论 | 京东云技术团队

    引言 <双色球头奖概率与被雷劈中的概率哪个高?> <3人轮流射击,枪法最差的反而更容易活下来?> 让我们用Java来探索ta们! 悖论1:著名的三门问题 规则描述:你正在参加一 ...

  7. 加速tortoisegit的show log,减少等待时间

    KMSID: 81703 是否同步到KM: 是 是否原创: 是 标签: 游戏开发 允许复制: 是 允许评论: 是 允许导出PDF: 是 职业库分类KMS: 游戏-游戏程序 查看权限KMS:网易正式员工 ...

  8. 使用docker部署一个go应用

    使用docker部署一个go应用 前言 直接部署 构建镜像 创建并运行容器 使用docker-compose部署 上传到docker-hub,然后拉取镜像,部署 参考 使用docker部署一个go应用 ...

  9. TextBrewer:融合并改进了NLP和CV中的多种知识蒸馏技术、提供便捷快速的知识蒸馏框架、提升模型的推理速度,减少内存占用

    TextBrewer:融合并改进了NLP和CV中的多种知识蒸馏技术.提供便捷快速的知识蒸馏框架.提升模型的推理速度,减少内存占用 TextBrewer是一个基于PyTorch的.为实现NLP中的知识蒸 ...

  10. 7.2 Windows驱动开发:内核注册并监控对象回调

    在笔者上一篇文章<内核枚举进程与线程ObCall回调>简单介绍了如何枚举系统中已经存在的进程与线程回调,本章LyShark将通过对象回调实现对进程线程的句柄监控,在内核中提供了ObRegi ...