git-consistent
v1.1.4
Published
Give consistency to your project's git logs.
Downloads
10
Readme
git-consistent
Give consistency to your project's git logs.
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 <[email protected]>
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 <[email protected]>
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'
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 <[email protected]>
Date: Sat Feb 10 15:13:40 2018 +0900
feat: duet test
Signed-off-by: foo <[email protected]>
Type list sample
.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>
| key | description | value |
| ---------------- | -------------------------------------------------- | ------------------------------------------------------------------------ |
| term | .gitcommit_template's term | string |
| option key | term's options | type
, required
, description
, values
, prefix
, suffix
, rules
|
| type
| term's input type | enum
, string
, text
, variable
, branch
|
| required
| required? | boolean |
| description
| term's description | string |
| values
| enum's values | Array |
| prefix
| a decoration to be attached before the input value | string |
| suffix
| a decoration to be attached after the input value | string |
| regExp
| (type: branch
only) regular expression for extracting values from branch names | string |
| regExpMatchNum
| (type: branch
only) number of values to retrieve from the match specified by regExp
| string |
| regExpFlag
| (type: branch
only) regExp
's falg | i
|
| rules
| input value format rules | Object |
| rule key | rule's type | firstLetter
, dotAtEnd
, nonAscii
, numberOnly
|
| firstLetter
| upper case or lower case about input value's first letter | upper
, lower
|
| dotAtEnd
| need dot (.
) input value's last | boolean |
| nonAscii
| Use not ascii symbols | boolean |
| numberOnly
| number only? | boolean |
| maxLength
| max length of string | integer |
| minLength
| min length of string | integer |
Command options
| Option | Description |
| ------------------- | ------------------------- |
| -d, --duet
| run git-duet mode |
| -D, --dry-run
| run dry-run mode |
| -i, --interactive
| run interactive mode |
| -S, --silent
| don't show commit command |
| -I, --init
| generate config files |
| -V, --version
| output the version number |
Badges
- 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"]