24

GIt commit 规范

 4 years ago
source link: https://studygolang.com/articles/30978
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

最近有幸参与到了一个开源项目的活动,看到别人提交的 commit 都很规范,自己的都是些什么鬼?经过一番搜索,发现网上很多都提到了 angularjs 的规范

格式

Commit Message 格式

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

分为 页眉、正文和页脚。其中页眉包括了类型、范围还有 subject。

type

类型 描述 feat 新增 feature fix 修复bug docs 仅仅修改了文档,比如 README... style 修改了空格、格式缩进、逗号等,不改变代码逻辑 refactor 代码重构,没有加新功能或者修复bug perf 优化相关,比如提升性能、体验 test 测试用例,比如单元测试、集成测试等 chore 改变构建流程、或者增加依赖库、工具等 revert 回滚到上一个版本

scope

具体改动的文件

subject

对正文的概括

body

just as in <subject> use imperative, present tense: “change” not “changed” nor “changes”

includes motivation for the change and contrasts with previous behavior

footer

不兼容变动

如果当前代码和上一个版本不兼容,需要在这里以 BREAKING CHANGE 开头,后面接具体的描述

相关 issues

这里是和变动相关的 issues。例如:

Closed bugs should be listed on a separate line in the footer prefixed with "Closes" keyword like this:

Closes #234

or in case of multiple issues:

Closes #123, #245, #992

工具

既然有标准了,那肯定就会有对应的工具来辅助人们写 commit message,工具貌似还不少,我这里使用 git-cz

在需要使用 git commit 的时候换成 git cz 就行了。

就像这样

zi22yqi.jpg!mobile

是不是很方便?

公众号:没有梦想的阿巧 后台回复 "群聊",一起学习,一起进步

有疑问加站长微信联系

iiUfA3j.png!mobile

Recommend

  • 53
    • www.tuicool.com 5 years ago
    • Cache

    Git commit message规范

    【编者的话】Git是现在市面上最流行的版本控制工具,书写良好的commit message能大大提高代码维护的效率。但是在日常开发中由于缺少对于commit message的约束,导致填写内容随意、质量参差不齐,可读性低亦难以维护。在项目中引入commit m...

  • 31

    Git Commit Message 规范与模板 业界标准:AngularJS 来自

  • 15

    stardard JS 代码规范及 pre-commit hookMar 18, 2017作者:blue 版权声明:本文为博主原创,转载请注明出处。 今天主要安利一个 JavaScript 代码规范

  • 15

  • 9
    • lesofn.com 3 years ago
    • Cache

    Git Commit Log规范推荐

    Git Commit Log规范推荐 木小丰 2020年12月13日 5,402次浏览 一、背景 Git每次提交代码都需要写commit message...

  • 5
    • leejarod.wordpress.com 3 years ago
    • Cache

    规范你的Git Commit message – 简书

    规范你的Git Commit message – 简书 规范你的Git Commit message2019.06.10 22:51:49字数 302阅读 5写在前面关于Git,大家想必都很熟悉,因为我们几乎每天都在重复着git add、git commit、git push等命令,自然也就留下很多“痕迹”,如果没有好...

  • 10
    • segmentfault.com 3 years ago
    • Cache

    规范你的commit msg

    TL;DR:👉 commitizen 使用👉 commitlint 使用👉 可以直接抄走的配置👉 git cz 的原理

  • 4
    • www.taoweng.site 3 years ago
    • Cache

    git commit 规范和 如

    git commit 规范和 如何在 commit 里使用 emoji git commit 规范和 _ 桃翁 Sunday, September 5th 2021, 3:3...

  • 4

    通过工具规范git提交信息也是工程化的一部分,在前端领域有一些工具为我们提供了相关功能,在这里做一下使用总结。 commitlint commitlint是什么? 就像eslint用来检查js代码是否标准,commitlint用来检查提交信息...

  • 5

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK