Luck、Time

  • 主页
  • 小说鉴赏
  • 专业笔记
  • 个人简介
所有文章 友链 关于我

Luck、Time

  • 主页
  • 小说鉴赏
  • 专业笔记
  • 个人简介

git-commit-的规范化

2017-08-18

资料来源1 commit 的使用规范介绍
资料来源2 commitzen 的安装指南

commit介绍

我们在每次提交代码时,都需要编写Commit Message,否则是不允许提交的。

1
git commit -m "first commit with userInfo service"

编写Commit Message需要遵循一定的范式,内容应该清晰明了,指明本次提交的目的,便于日后追踪问题。commitizen就是这么样一款工具,他用来规范化我们的commit消息。

安装指南

1
2
3
4
5
6
7
8
1.安装commitizen sudo npm install -g commitizen
配置cd到.git所在目录
2.commitizen init cz-conventional-changelog --save --save-exact
3.使用用git cz命令来取代git commit
异常情况 有可能提示你缺少[package.json]的下载地址
配置第二个项目当我们配置第二个项目的时候我们只需要进入到对应的.git文件夹下,
输入如下的命令commitizen init cz-conventional-changelog --force我们就可以使用git cz命令了

commitzen 详解

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
commitizen详解 Message 格式一般来说,
Commit Message 应包含三部分内容:Header、Body、Footer
<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>
HeaderHeader部分应只包含一行,包括三个字段:type、scope和subject
type :用于说明Commit的类型,包含一下7种类型
feat:新功能(feature)
fix:修补bug
docs:文档(documentation)
style: 格式(不影响代码运行的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
test:增加测试
chore:构建过程或辅助工具的变动
scope scope用于说明本次Commit所影响的范围,比如controller、user或者 README,视项目的不同而不同。
subject:是本次Commit目的的简短描述,一般不要超过50个字符
以动词开头,使用第一人称现在时,比如change,而不是changed或changes
第一个字母小写 结尾不加句号(.)
BodyBody是对本地提交的一个详细描述,下面是一个示例
More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. Further paragraphs come after blank lines. - Bullet points are okay, too - Use a hanging indent
FooterFooter只用于两种情况
**不兼容改动**如果当前代码与上一个版本不兼容,则 Footer 部分以BREAKING CHANGE开头,后面是对变动的描述、以及变动理由和迁移方法。
**关闭Issue**如果当前Commit是针对某个Issue的提交,那么久可以在Footer中关闭这个Issue:Closes
赏

感谢对我的支持,让我们一起努力吧

谢谢你哦
  • PHP
  • 专业笔记

扫一扫,分享到微信

微信分享二维码
韩语
韩语
Like Issue Page
Error: Comments Not Initialized
Login with GitHub
Styling with Markdown is supported
Powered by Gitment
© 2017 Luck、Time
Hexo Theme Yilia by Litten
  • 所有文章
  • 友链
  • 关于我

tag:

  • Html
  • jquery
  • Mysql
  • PHP
  • Weather
  • GTM
  • GA
  • Hexo
  • ionic
  • 推广
  • 接口集合
  • Wordpress
  • Map
  • 插件集合
  • 日记
  • fighting
  • 自学
  • 安卓
  • 小程序
  • wepy
  • 抓包
  • 祭祀
  • 知识总结
  • 小说鉴赏
  • 太宰治
  • 梭罗
  • 美句

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • 友情链接1
  • 友情链接2
  • 友情链接3
  • 友情链接4
  • 友情链接5
  • 友情链接6