Skip to content
On this page

markBreakingChangeMode

添加 ! 标识,表明该 commit 消息属于重大变更

See: 该规则来自 Conventional Commits
E.g:

text
# Commit message 带有 ! 提示重大变更
feat!: send an email to the customer when a product is shipped

# Commit message 与范围以及 ! 标识提示重大变更
feat(api)!: send an email to the customer when a product is shipped

# Commit message 带有 ! 提示重大变更以及底部说明
chore!: drop support for Node 6

BREAKING CHANGE: use JavaScript features not available in Node 6.
# Commit message 带有 ! 提示重大变更
feat!: send an email to the customer when a product is shipped

# Commit message 与范围以及 ! 标识提示重大变更
feat(api)!: send an email to the customer when a product is shipped

# Commit message 带有 ! 提示重大变更以及底部说明
chore!: drop support for Node 6

BREAKING CHANGE: use JavaScript features not available in Node 6.

使用配置项: markBreakingChangeMode

额外添加 "BREAKINGCHANGE"的提问,询问是否需要添加 "!" 标识

js
// .commitlintrc.js

/** @type {import('cz-git').UserConfig} */
module.exports = {
  prompt: {
    markBreakingChangeMode: true
  }
};
// .commitlintrc.js

/** @type {import('cz-git').UserConfig} */
module.exports = {
  prompt: {
    markBreakingChangeMode: true
  }
};

示例: demo-gif

使用 commitizen CLI + cz-git

可以尝试运行命令自动添加标识:

sh
break=1 cz
break=1 cz

示例: demo-gif

使用 cz-git CLI czg

可以尝试运行命令自动添加标识:

sh
czg break
czg break

示例: demo-gif

我只是尽力将工具做得更好,如果可以的话欢迎给一个star ⭐