1.1.4 • Published 8 months ago

git-consistent v1.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
8 months ago

git-consistent Test and Lint "npm" MIT "git-consistent friendly"

npm.io

Give consistency to your project's git logs.

"node v14" "node v16" "node v17" "node v18" "node v20"

Samples

Install

$ npm install -g git-consistent
# or
$ yarn global add git-consistent

Optional settings

# set alias
$ git config --global alias.con "consistent -i"

# setting editor (for text type input) if you use editor other than vim.
$ export EDITOR='code -w'
# or
$ export EDITOR='atom -w'
# or
$ export EDITOR='subl -w'
# or etc.

Usage

Init

$ git consistent --init
Use Type? (Y/n): Y
Use Emoji? (y/N): N
Does the subject start with lower case? (Y/n): Y
Does the subject put dot (.) at end? (y/N): Y

Generated '.gitcommit_template' and '.git_consistent'.
You can edit them freely.
Enjoy!

Output usage

$ git-consistent --help

  Usage: git-consistent [options]


  Options:

    --type <type>            commit type
    -m, --subject <subject>  The subject contains succinct description of the change
    --body [body]            The body contains details of the change (default: )
    ...
    -V, --version            output the version number
    -h, --help               output usage information

Inline mode

$ git consistent --type="feat" --subject="implement new feature" --body="This is amazing feature."

Interactive mode

$ git consistent -i
Select type: feat
Enter subject: implement new feature
Enter body multiline:
This is amazing feature.

You can use both mode interactive and inline at the same time. In that case, you input value that are not given as option only.

$ git consistent -i --subject="implement new feature"
Select type: feat
Enter body multiline:
This is amazing feature.

--subject have alias of -m. You can commit like you normally do!

$ git config --global alias.con "consistent -i"
$ git con -m "write README"
? Select type: docs
git commit -m "docs: write README"

Advance

Decorate

scope:
  type: text
  required: false
  description: 'The scope could be specifying place of the commit change.'
  prefix: '('
  suffix: ')'

format check

subject:
  type: string
  required: true
  description: 'The subject contains succinct description of the change'
  rules:
    firstLetter: lower
    dotAtEnd: false
    ascii: false
$ git consistent --subject="Write documents."
subject must be first letter is lowercase.
subject should not put dot (.) at the end.

$ git consistent --subject="ドキュメントを書いた"
subject must be first letter is lowercase.
subject should only alphabet.

variables

<githubIssueNum> <subject>

<githubIssueUrl>
<body>
githubIssueNum:
  type: string
  required: false
  description: 'github issue number'
  prefix: 'fix #'
subject:
  type: string
  required: true
  description: 'The subject contains succinct description of the change'
githubIssueUrl:
  type: variable
  origin: githubIssueNum
  description: 'github issue url'
  prefix: 'https://github.com/isuke/git-consistent/issues/'
body:
  type: text
  default: ''
  required: false
  description: 'The body contains details of the change'
$ git consistent -i --subject="test" --body="This is test."
Enter githubIssueNum: 12

$ git log -n 1
commit a9d6457f3674c8620fbe72c769cee09ba5459f02
Author: isuke <isuke770@gmail.com>
Date:   Sat Feb 10 17:40:33 2018 +0900

    fix #12 test

    https://github.com/isuke/git-consistent/issues/12
    This is test.

branch

<subject>

<issueLink><body>
...
issueLink:
  type: branch
  required: false
  description: 'Github issue link'
  regExp: 'issue([0-9]+)'
  prefix: 'https://github.com/you/repository/issues/'
  suffix: "\n"
...
$ git branch
* issue123_hoge
  master

$ git consistent -i --subject="test" --body="This is test."

$ git log -n 1
commit a9d6457f3674c8620fbe72c769cee09ba5459f02
Author: isuke <isuke770@gmail.com>
Date:   Sat Feb 10 17:40:33 2018 +0900

    test

    https://github.com/you/repository/issues/123
    This is test.

emoji

emoji:
  type: enum
  required: true
  description: 'commit type'
  values:
    -
      name: ':heavy_plus_sign:'
      description: 'when implementing function'
    -
      name: ':sunny:'
      description: 'when fixing a bug'
    -
      name: ':art:'
      description: 'when refactoring'

npm.io

git-duet

Run git-duet mode when with -d option.

$ git consistent -d --type="feat" --subject="duet test" --body=""

$ git log -n 1
Author: isuke <isuke770@gmail.com>
Date:   Sat Feb 10 15:13:40 2018 +0900

    feat: duet test

    Signed-off-by: foo <foo@example.con>

Type list sample

sample type list

.git_consistent format

<term>:
  <option key>: <option value>
  <option key>: <option value>
  <option key>: <option value>
<term>:
  <option key>: <option value>
  <option key>: <option value>
  <option key>: <option value>
<term>:
  <option key>: <option value>
  <option key>: <option value>
  <option key>: <option value>
keydescriptionvalue
term.gitcommit_template's termstring
option keyterm's optionstype, required, description, values, prefix, suffix, rules
typeterm's input typeenum, string, text, variable, branch
requiredrequired?boolean
descriptionterm's descriptionstring
valuesenum's valuesArray
prefixa decoration to be attached before the input valuestring
suffixa decoration to be attached after the input valuestring
regExp(type: branch only) regular expression for extracting values from branch namesstring
regExpMatchNum(type: branch only) number of values to retrieve from the match specified by regExpstring
regExpFlag(type: branch only) regExp's falgi
rulesinput value format rulesObject
rule keyrule's typefirstLetter, dotAtEnd, nonAscii, numberOnly
firstLetterupper case or lower case about input value's first letterupper, lower
dotAtEndneed dot (.) input value's lastboolean
nonAsciiUse not ascii symbolsboolean
numberOnlynumber only?boolean
maxLengthmax length of stringinteger
minLengthmin length of stringinteger

Command options

OptionDescription
-d, --duetrun git-duet mode
-D, --dry-runrun dry-run mode
-i, --interactiverun interactive mode
-S, --silentdon't show commit command
-I, --initgenerate config files
-V, --versionoutput the version number

Badges

git-consistent friendly

  • Markdown
[![git-consistent friendly](https://img.shields.io/badge/git--consistent-friendly-brightgreen.svg)](https://github.com/isuke/git-consistent)
  • reStructuredText
.. image:: https://img.shields.io/badge/git--consistent-friendly-brightgreen.svg   :alt: git-consistent friendly   :target: https://github.com/isuke/git-consistent
  • AsciiDoc
image:https://img.shields.io/badge/git--consistent-friendly-brightgreen.svg["git-consistent friendly",link="https://github.com/isuke/git-consistent"]
1.1.4

8 months ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.9.9

5 years ago

0.9.8

5 years ago

0.9.7

5 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.9

6 years ago

0.8.8

6 years ago

0.8.7

6 years ago

0.8.6

6 years ago

0.8.5

6 years ago

0.8.0

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago