目 录CONTENT

文章目录

Idea 中 Git Commit Template 插件的使用

码农街
2024-01-30 / 0 评论 / 0 点赞 / 25 阅读 / 5246 字 / 正在检测是否收录...

前言

Git源码中的 Documentation/SubmittingPatches 列举了git提交规范相关的说明文档。

一个统一的commit消息模板可以约束团队成员使用一致的方式提交变更信息,这样也方便集成工具进行合规检查。

通常来讲,commit信息应该包含如下内容:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

插件地址

https://plugins.jetbrains.com/plugin/9861-git-commit-template

也可以在plugins中搜索“Git Commit Template”,然后install即可

插件说明

使用该插件后可以在提交的时候按照指定的模板填写Commit Message

插件使用

提交的时候,点击Commit Message 输入框右上角第一个图标

在“Type of change”选择 一个commit类型

  1. Type of change 表示提交类型

  2. scope of this change 表示影响范围

如:route, component, utils, build等 subject表示commit概述,建议符合50/72 formatting body表示具体修改的内容,可以分为多行,每一行建议符合50/72 formatting footer是一些备注信息, 通常是BREAKING CHANGE或修复的BUG链接,如:issue #123

  1. Short description 表示提交目的的简短描述(必填)

  2. Long description 表示提交的长描述,用于描述此次提交(非必填)

输入相关信息,点击"OK"即可

Type of change 可选值

Type of change 类型可选值如下:

  1. feat: A new feature => 新功能

  2. fix: A bug fix => 修复某个BUG

  3. docs: Documentation only changes => 文档更新

  4. style: Changes that do not affect the meaning of the code (white-space, formatting, etc) => 代码格式变动

  5. refactor: A code change that neither fixes a bug nor adds a feature =>代码重构

  6. perf: A code change that improves performance =>优化相关,比如提升性能、体验。

  7. test: Adding missing tests or correcting existing tests =>提交测试

  8. build: Changes that affect the build system or external dependencies (e.g: gulp, npm) =>构建

  9. ci:Changes to our CI configuration files and scripts (e.g: Travis, Circle, BrowserStack, SauceLabs) =>CI相关

  10. chore: Other changes that don’t modify src or test files =>构建或者辅助工具变动

  11. revert: Reverts a previous commit=>回滚到上一个版本

0

评论区