Skip to content

Git

仲灏2022-04-09约 1 分钟

信息提交规范

提交忽略配置

https://www.toptal.com/developers/gitignore/

.gitignore

git
.DS_Store
# dependencies
node_modules
**/node_modules

# production
build
src/.umi
dist

# api-doc ignore
doc


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# screenshot
screenshot
.firebase
.eslintcache

# Editor directories and files
.idea
# .vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# visual studio code
.history
*.log
functions/*
.temp/**

提交信息规范

commitizen

https://github.com/commitizen/cz-cli

当您使用 Commitizen 提交时,系统会提示您在提交时填写所有必需的提交字段。无需再等到稍后运行 git commit 挂钩并拒绝您的提交(尽管这仍然会有所帮助)。无需再通过 CONTRIBUTING.md 来查找首选格式。获取有关您的提交消息格式的即时反馈,并提示您输入必填字段。

cz-git

https://cz-git.qbb.sh/zh/guide/

一款工程性更强,轻量级,高度自定义,标准输出格式的 commitizen 适配器,比下面两个更优,更优雅

cz-customizable :

cz-conventional-changelog

cz-git 与 commitlint 进行联动给予校验信息

commitlint

https://github.com/conventional-changelog/commitlint

帮助您的团队遵守提交约定。通过支持npm安装的配置,它可以轻松地共享提交约定。

img

使用:

  • yarn add -D @commitlint/cli @commitlint/config-conventional

  • echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js

自动生成版本日志 CHANGELOG

conventional-changelog-cli

https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli

讨论区

欢迎留下想法与补充