关于git:我是怎么写-Git-Commit-message-的

8次阅读

共计 1209 个字符,预计需要花费 4 分钟才能阅读完成。

作用

编写格式化的 commit message 可能大大提高代码的保护效率。

比方:

  • 能够提供更多的历史信息,不便疾速浏览;
  • 能够过滤某些 commit(比方文档改变),便于疾速查找信息;
  • 能够间接从 commit 生成 Change log

用的什么标准?

<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>

其中,Header 是必须的,Body 和 Footer 能够省略。

type

type 用于阐明 commit 的类别。

  • feature A new feature
  • fix A bug fix
  • docs Documentation only changes
  • style Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • 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 (example scopes: gulp, broccoli, npm)
  • ci Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore Other changes that don’t modify src or test files
  • revert Reverts a previous commit

scope

scope 用于阐明 commit 影响的范畴,比方数据层、管制层、视图层、具体模块等等,视我的项目不同而不同。

subject

subject 是 commit 目标的简短形容,不超过 50 个字符。

body

Body 局部是对本次 commit 的详细描述,能够分成多行。

footer

BREAKING CHANGE,用来形容以后 commit 与上一个版本不兼容的中央。

Issue,用来形容以后 commit 针对的某个 issue。

参考文章

Commit message 和 Change log 编写指南

用的什么辅助工具?

太教条了,太累 … 给大家分享一个我应用的工具。

JetBrains IDE 插件,在 GoLandPhpStorm 中 都能够在插件市场搜寻 Git Commit Message Helper

插件地址:Git Commit Message Helper

装置后成果,在 git commit 时:

咱们看一下成果:

这时,点击 Commit 或 Commit and Push… 即可。

赶快去体验吧。

举荐浏览

  • 函数的不定参数你是这样用吗?
正文完
 0