title: git的commit用法 date: 2022-04-29 15:43:43 tags: git
实话说我认为有些没必要,或许不应该在这种小事上大费周章,或许有些吹毛求疵吧,但我还是希望养成一个好的习惯 node_modules的设计....有些臃肿,不是很喜欢 参考知乎文章
配置 npm
配置 Commitizen
以格式化 commit message
npm install -g commitizen
npm install -g conventional-changelog conventional-changelog-cli
conventional-changelog-cli@2.2.2
npm ls -g -depth=0
至此安装过程结束,以下为每次新建项目后需要执行的操作
npm init --yes
Angular
的 Commit message
格式commitizen init cz-conventional-changelog --save --save-exact
CHANGELOG.md
文件conventional-changelog -p angular -i CHANGELOG.md -s
git commit
命令的时候统一改为 git cz
,然后就会出现选项,生成符合格式的Commit Message
feat: A new feature (新功能) _____**常用**
fix: A bug fix (修复bug) _____**常用**
docs: Documentation only changes (文档改变) _____**常用**
style: Changes that do not affect the meaning of the code (代码格式变更)
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 (改变build工具,webpack/npm)
ci: Changes to our CI configuration files and scripts (更改ci configuration)
chore: Other changes that don't modify src or test files (一些不更改src或者test相关文件的提交) _____**常用**
revert: Reverts a previous commit (撤销上一次commit)
? What is the scope of this change (e.g. component or file name): (press enter to skip)
说明此次修改的影响范围,可以根据自己的情况来进行填写
- all: 表示影响很大,如修改了整体依赖
- location: 表示影响小,修改了某个小的功能
- module: 表示会影响整个模块,如登录模块等
? Write a short, imperative tense description of the change (max 94 chars):
简要描述修改内容
? Provide a longer description of the change: (press enter to skip)
详细描述修改内容,可跳过
? Are there any breaking changes? (y/N)
大改动
? A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself:
? Describe the breaking changes:
? Does this change affect any open issues? (y/N)
解决issue时
Add issue references (e.g. "fix #123", "re #123".):