We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cz
pnpm install -g commitizen
pnpm install -g cz-conventional-changelog
{ "path": "cz-conventional-changelog" }
pnpm install --save-dev commitizen
{ "scripts": { "commit": "git-cz", }, "config": { "commitizen": { "path": "node_modules/cz-conventional-changelog" } } }
pnpm install cz-customizable -D
"scripts" : { ... "commit": "./node_modules/cz-customizable/standalone.js" } "config": { "commitizen": { "path": "node_modules/cz-customizable" } }
module.exports = { types: [ { value: 'feat', name: 'feat: 新功能', }, { value: 'fix', name: 'fix: 修复bug', }, { value: 'init', name: 'init: 初始化', }, { value: ':pencil2: docs', name: 'docs: 文档变更', }, { value: 'style', name: 'style: 代码的样式美化', }, { value: 'refactor', name: 'refactor: 重构', }, { value: 'perf', name: 'perf: 性能优化', }, { value: 'test', name: 'test: 测试', }, { value: 'revert', name: 'revert: 回退', }, { value: 'build', name: 'build: 打包', }, { value: 'chore', name: 'chore: 构建/工程依赖/工具', }, { value: 'ci', name: 'ci: CI related changes', }, ], messages: { type: '请选择提交类型(必填)', customScope: '请输入文件修改范围(可选)', subject: '请简要描述提交(必填)', body: '请输入详细描述(可选)', breaking: '列出任何BREAKING CHANGES(可选)', footer: '请输入要关闭的issue(可选)', confirmCommit: '确定提交此说明吗?', }, allowCustomScopes: true, allowBreakingChanges: ['feat', 'fix'], // 当提交类型为feat、fix时才有破坏性修改选项 subjectLimit: 72, }
hook 检查提交的注释是否符合规范(commitlint),将暂存区的代码(lint-staged)运行 lint
commit-msg 文件
#!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" npx --no-install commitlint --edit $1
pre-commit 文件
#!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" npx --no-install lint-staged
首次提交时 husky 可能会报错,可通过git commit --no-verify --allow-empty -m "initial commit"
git commit --no-verify --allow-empty -m "initial commit"
参考
The text was updated successfully, but these errors were encountered:
No branches or pull requests
git-cz
pnpm install -g commitizen
方式一
pnpm install -g cz-conventional-changelog
{ "path": "cz-conventional-changelog" }
pnpm install --save-dev commitizen
方式二(自定义配置 git commit 注释规范)
pnpm install cz-customizable -D
如:
husky 配置
commit-msg 文件
pre-commit 文件
参考
The text was updated successfully, but these errors were encountered: