commitizen(git commit format)
发布日期:2022-02-14 23:02:42
浏览次数:19
分类:技术文章
本文共 2171 字,大约阅读时间需要 7 分钟。
- Install
- commitizen install
sudo npm install -g commitizen
-
first project config
- config
cd Path_Git_Porject# base config commitizen init cz-conventional-changelog --save --save-exact # config with format check npm i -D husky @commitlint/config-conventional @commitlint/cli
- if config with format check, need to config js and husky
- create commitlint.config.js(with same path of package.json)
echo 'module.exports = {extends: ["@commitlint/config-conventional"]};' > ./commitlint.config.js
- husky(add package.json)
..., "husky": { "hooks": { "commit-msg": "commitlint -e $GIT_PARAMS" } }
-
second project config
cd Path_Git_Porjectcommitizen init cz-conventional-changelog --force
- use
git cz relpace git commit
- use by interactive mode
1.Select the type of change that you're committing 选择改动类型 (
)2.What is the scope of this change (e.g. component or file name)? 填写改动范围 ( )3.Write a short, imperative tense description of the change: 写一个精简的描述 ( )4.Provide a longer description of the change: (press enter to skip) 对于改动写一段长描述 ()5.Are there any breaking changes? (y/n) 是破坏性修改吗?默认n ( - commit message format:husky will use commitlint check message format
( ): - Install ERROR or WARN
- Fromat
- type:必填项,用于指定commit的类型
- feat:增加新功能 (主要type)
- fix: 修复Bug (主要type)
- docs:只改动了文档相关的内容 (特殊type)
- style:不影响代码含义的改动,例如去掉空格、改变缩进、增删分号 (特殊type)
- build:构造工具的或者外部依赖的改动,例如webpack,npm (特殊type)
- refactor:代码重构时使用 (特殊type)
- revert:执行git revert打印的message (特殊type)
- scope:必填项,用于描述改动的范围,格式为项目名/模块名:如果一次commit修改多个模块,建议拆分成多次commit,以便更好追踪和维护
- Body:详细描述,主要描述改动之前的情况及修改动机,对于小的修改不作要求,但是重大需求、更新等必须添加body来作说明
- break changes:是否产生了破坏性修改,涉及break changes的改动必须指明该项,类似版本升级、接口参数减少、接口删除、迁移等
- affect issues:是否影响了某个问题。例如我们使用jira时,我们在commit message中可以填写其影响的JIRA_ID,若要开启该功能需要先打通jira与gitlab
- type:必填项,用于指定commit的类型
- git config file
- .gitconfig:the config of current user
- Windows:C:\Users\administrator.gitconfig
- Linux: ~/.gitconfig
- .git:the config of current project
- .gitconfig:the config of current user
转载地址:https://blog.csdn.net/fish2009122/article/details/103416926 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月07日 07时25分12秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
如何利用pyecharts绘制酷炫的桑基图?
2019-04-27
王朝阳:河北高校邀请赛 -- 二手车交易价格预测决赛答辩
2019-04-27
Scratch等级考试(二级)模拟题
2019-04-27
如何在Jupyter Lab中显示pyecharts的图形?
2019-04-27
什么是Python之禅?
2019-04-27
【青少年编程】【Scratch】01 运动模块
2019-04-27
json的序列化与反序列化
2019-04-27
【第16周复盘】学习的飞轮
2019-04-27
如何利用pyecharts绘制炫酷的关系网络图?
2019-04-27
NCEPU:线下组队学习周报(007)
2019-04-27
【青少年编程】【二级】寻找宝石
2019-04-27
【组队学习】【26期】Linux教程
2019-04-27
解决 nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory) 问题
2019-04-27
LeetCode-122. 买卖股票的最佳时机 II(Goland实现)
2019-04-27
LeetCode-136. 只出现一次的数字(Goland实现)
2019-04-27
go-递归实现二叉树的三种排序方式(前序、中序、后序)【详细】
2019-04-27
LeetCode-LCP 18. 早餐组合(Goland实现)
2019-04-27
C++从入门到进阶近100本书推荐电子书pdf
2019-04-28
蓝桥杯 - [2014年第五届真题]分糖果(模拟)
2019-04-28
蓝桥杯 - [2013年第四届真题]大臣的旅费(DFS)
2019-04-28