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.
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
As the Elegant team has already made the repository
you can start using it for your commits by entering
git-cz in your command shell instead
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
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.
For a quick video on how this process works in real life, click on the play button below.