Commity is a command line tool that will help you with commits conventions. You can configure Commity fast & easily so every collaborators can follow the commit convention you need.
node >= 14.16.0
npm i -g @pierred/commity
or
npm i -D @pierred/commity
Warning If your git diff tree is not clean, you may not want to use
-a
(--addAll
) option.
npm i -g @pierred/commity
commity init
commity -a
or
npm i -D @pierred/commity
npx commity init
npx commity -a
Create a new commity.json
configuration file.
Note If a configuration file already exists, you can reset the configuration file via rich-interaction.
Run Commity, allow to commit from chunks via rich-interaction. Workspace must be git initialized and commity friendly.
Add all changes to the index (git add --all
) before commit.
Push to remote after commit.
Note If cannot push e.g. because your branch has no upstream branch, commity will be able to commit anyway.
Return usage informations.
Bump version.
You can setup chunks
& render
in commity.json
file.
{
"chunks": [
{
"scope": {
"label": "Select the type of change that you're committing",
"type": "select",
"selectOptions": [
{
"value": "feat",
"description": "A new feature"
},
{
"value": "fix",
"description": "A bug fix"
},
{
"value": "docs",
"description": "Documentation only changes"
},
{
"value": "refactor",
"description": "Changes that neither fixes a bug or adds a feature"
},
{
"value": "spec",
"description": "Changes that affect unit tests"
},
{
"value": "pkg",
"description": "Changes that affect package (deps, config, readme...)"
}
]
}
},
{
"message": {
"label": "Choose the commit message",
"decorations": {
"prefix": ": "
}
}
},
{
"ticket": {
"label": "What is the issue id",
"decorations": {
"prefix": " #"
},
"required": false
}
}
],
"render": "{{scope}}{{ticket}}{{message}}"
}
Each chunk is identified via the key and can be rendered as desired in render
area.
Can be simple
(default value) or select
.
Chunk description.
Choices for the chunk.
Weither the chunk is required.
Allow to decorate optional chunks so it don't mess the final render if the chunk is optional & skipped.
If the chunk is required, it's same as decorating in render
directly.
Formatted commit, replacing {{chunk's key}}
with the user input.
Theses variables can be used in render
option and cannot be used as chunk
.
branchName
current git branch name
More features incoming 🎉
Thanks goes to these wonderful people (emoji key):
PierreDemailly 💻 📖 |
Yefis 💻 👀 |
This project follows the all-contributors specification. Contributions of any kind welcome!