jbavari / proper-commit-messages

A quick sample project to enforce proper commit messages and hooks to confirm them

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repo aims at setting up a quick example of how you can properly keep a commit message convention and tools to enforce the messages. These tools also help generate a changelog very easily from these nicely crafted commit messages.

Getting Started

First ensure you have Node installed.

Install local node modules: npm install.

Install commitizen - npm install -g commitizen.

This will set you up for following a commit message convention (linked is the commit message convention for AngularJS).

Why?

This aims at enforcing commit messages so we get beautiful easy to read changelogs!

The what

  • commitizen - prompts to fill out any required commit fields at commit time
  • cz-conventional-changelog - commitizen adapter for the angular preset of conventional-changelog
  • Husky - running git hooks from npm made easy
  • validate-commit-msg - git hooks to validate git commit messages based on convention(s)

The How

If you type git cz, you will be prompted with steps to guide you along to crafting a nice commit message that follows the convention.

If you do not, there will be git hooks that run (via the npm run script commitmsg that runs validate-commit-msg) and be alerted with a warning to correct your commit message.

The Changelog

To generate the changelog, type npm run changelog, and view the changelog.

Enjoy!

About

A quick sample project to enforce proper commit messages and hooks to confirm them


Languages

Language:JavaScript 100.0%