The Elegant Contribution Guidelines require that each commit submitted for consideration be formatted according to the Git Commit Guidelines.
To make this process easier, the Elegant repository is configured to support the Commitizen tool. This tool saves time by controlling the format of the Git commit messages to a set of predefined options and patterns. This formatting allows for our release process to be fully automated.
Prerequisites
Both Node.js and Yarn must be installed on your system.
Install Commitizen
From your command line terminal, go into the directory containing your fork of the Elegant repository, then execute the following commands:
yarn global add commitizen
yarn install
Use Commitizen
As the Elegant team has already made the repository
Commitizen friendly,
you can start using it for your commits by entering git-cz
in your command shell instead
of git commit
. Make sure the changes that you want to commit to your fork are staged.
Once invoked, Commitizen will prompt you for answers to a number of questions. As mentioned
previously, the answers to these questions are formatted according to the
Git Commit Guidelines
before being placed into the message field for the commit. Commitizen then follows through and
invokes git commit
, committing the staged changes along with the formatted message that was
crafted for you from the answers you provided.
In some cases, such as a Git pre-commit hook failure, you may
not want to re-answer the questions again. Once you fix the issues that prevented the
commit from happening, you can use git-cz --retry
to submit the commit again using the same
answers that were used in the failed attempt.
Video Demonstration
For a quick video on how this process works in real life, click on the play button below.