DEV Community

Yuto
Yuto

Posted on

How to use Commitizen - Unify commit messages

Introduction

  • I often get lost when entering a commit message
  • Commit messages are not unified and not simple

Due to such concerns, I have introduced Commitizen this time.

What is Commitizen?

Official page
https://github.com/commitizen/cz-cli

Type 'git cz' to see your choices.
It's a tool that allows you to create simple and easy-to-understand commit messages just by answering interactively.
スクリーンショット 2021-01-30 15.39.55

How to install Commitizen

Type this commands



npm install commitizen -g
npm install -g cz-conventional-changelog
echo '{ "path": "cz-conventional-changelog" }' >> ~/.czrc
exec $SHELL -l


Enter fullscreen mode Exit fullscreen mode

How to use Commitizen

Start with the 'git cz' command.



git cz


Enter fullscreen mode Exit fullscreen mode

スクリーンショット 2021-01-30 15.39.55

This time I just added README.md, so select 'docs'.
スクリーンショット 2021-01-30 15.40.08

I was asked for the scope of this change, so type in 'README.md'.
スクリーンショット 2021-01-30 15.40.24

Then enter a short description.
This time I typed 'add README'.
スクリーンショット 2021-01-30 15.40.38

Then enter a long description.
I didn't need a detailed explanation this time, so I skipped it with Enter Key.
スクリーンショット 2021-01-30 15.40.51

I was asked if there were any breaking changes, but this time it's no.
スクリーンショット 2021-01-30 15.41.02

I was asked if it was related to the issue, but this is No.
スクリーンショット 2021-01-30 15.41.13

That's it.
Let's see what kind of commit message was created.



docs (readme.md): add README  


Enter fullscreen mode Exit fullscreen mode

スクリーンショット 2021-01-30 15.41.39

Conclusion

That's how to use Commitizen.
Thank you for watching.

Please follow me on Twitter.
If you have a project, please contact me on Twitter.
https://twitter.com/n199603

Top comments (1)

Collapse
 
evgenyhalvin profile image
Eugene

thank you!