damianopetrungaro/php-commitizen

帮助编写遵循常规提交规范的 Git 提交

v0.2.0 2020-07-15 23:51 UTC

This package is auto-updated.

Last update: 2024-09-16 09:12:23 UTC


README

Scrutinizer Code Quality Code Coverage Build Status

Commitizen 是一个用于创建干净、易读的 Git 历史记录的良好提交的实用工具。

此工具遵循 常规提交规范 以及在 这些幻灯片 中描述的一些最佳实践。

安装和使用

您可以使用 composer 轻松安装

$ php composer.phar require --dev damianopetrungaro/php-commitizen

使用也很简单

$ php vendor/bin/php-commitizen commit

您还可以

  • 通过添加 -a 标志来将所有文件添加到暂存区
  • 通过指定配置文件路径作为参数来指定自定义配置文件

您可以使用 $ php vendor/bin/php-commitizen commit --help 获取更多信息

配置文件

配置文件必须返回一个数组(或部分覆盖)

<?php

return [
    'type' => [
        'lengthMin' => 1, // Min length of the type
        'lengthMax' => 5, // Max length of the type
        'acceptExtra' => false, // Allow adding types not listed in 'values' key
        'values' => ['feat', 'fix'], // All the values usable as type
    ],
    'scope' => [
        'lengthMin' => 0, // Min length of the scope
        'lengthMax' => 10, // Max length of the scope
        'acceptExtra' => true, // Allow adding scopes not listed in 'values' key
        'values' => [], // All the values usable as scope
    ],
    'description' => [
        'lengthMin' => 1, // Min length of the description
        'lengthMax' => 44, // Max length of the description
    ],
    'subject' => [
        'lengthMin' => 1, // Min length of the subject
        'lengthMax' => 50, // Max length of the subject
    ],
    'body' => [
        'wrap' => 72, // Wrap the body at 72 characters
    ],
    'footer' => [
        'wrap' => 72, Wrap the footer at 72 characters
    ],
];