CMF is a simple-to-use utility to standarized commit messages on projects.
- Installation via npm command is now deprecated and no longer maintained on V3.
- You can still be using your
.cmf.yaml
file. Now you can extend this file with new attributes.
- .cmf.yaml file is no longer required if you want to use a simple flow.
- The default flow of v3 is now strongly forced to use Conventional Commits.
- CMF binary is renamed to git-cmf, so now you can use it directly from git as
git cmf
command. - CMF is now available from Homebrew.
cmf init
is cleaner now, it just creates a .cmf.yaml file with a simple flow to let you customize as you want.
- Using go install:
go install github.com/walmartdigital/commit-message-formatter
- Using Brew:
brew tap walmartdigital/homebrew-git-cmf
brew install git-cmf
- Download binaries from Github
If you want to customize your flow, you can run git cmf init
,
this command will create a .cmf.yaml file with the default flow.
Then you can change the flow as you want.
CMF has inner variables and you can access it throw templates using {{}}
:
- {{BRANCH_NAME}} it will print the current branch name of your repository
Additionally, you can include external environment variables using the ENV block described on the template.
It is possible to config CMF as you like, you can change
custom flows, templates, or assign default flows. You can do this using
a local file on the root of your project or set as global
preferences with a file on your Home directory called .cmf.yaml
.
A .cmf.yaml
file is composite by 3 main blocks:
- ENV
- PROMPT
- TEMPLATE
It is a list of environment variables names, that later are mappings to be accessible from other blocks.
ENV:
- ENVIRONMENT_1
- ENVIRONMENT_2
...
- ENVIRONMENT_10
Describe an input flow.
You can create your custom flows using this configuration attribute. Every
KEY` attribute is mapping as a variable within the flow.
Prompt accepts two kinds of questions:
-
Single question:
- KEY variable name
- LABEL prompt title
-
Select question:
- KEY variable name
- LABEL prompt title
- OPTIONS list of options
- VALUE variable value
- DESC variable description
PROMPT:
- KEY: "CHANGE"
LABEL: "Select the type of change:"
OPTIONS:
- VALUE: "feature"
DESC: "A new feature"
- VALUE: "fix"
DESC: "A Bug fix"
- VALUE: "update"
DESC: "An update code change (moving or split code)"
- VALUE: "docs"
DESC: "Documentation only changes"
- VALUE: "style"
DESC: "Small changes of code style"
- VALUE: "test"
DESC: "Add, change or update test code"
- KEY: "MODULE"
LABEL: "Affected module:"
- KEY: "MESSAGE"
LABEL: "Commit message:"
TEMPLATE: "{{CHANGE}}({{MODULE}}): {{MESSAGE}}"
Defines the way the commit message will be formatted using variables described on .cmf.yaml file.
TEMPLATE: "{{CHANGE}}({{MODULE}}): {{MESSAGE}}"
Use GitHub issues for requests.
I actively welcome pull requests; learn how to contribute.
CMF is available under the MIT License.