Skip to content

A pre-commit hook that checks commit messages for Conventional Commits formatting

License

Notifications You must be signed in to change notification settings

BartKim-J/conventional-pre-commit-kor

 
 

Repository files navigation

Warning: 기존 conventional-pre-commit 에 한글 인식이 안되는 부분을 수정한 버전 입니다.

conventional-pre-commit

A pre-commit hook to check commit messages for Conventional Commits formatting.

Usage

Make sure pre-commit is installed.

Create a blank configuration file at the root of your repo, if needed:

touch .pre-commit-config.yaml

Add a new repo entry to your configuration file:

repos:

# - repo: ...

  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: <git sha or tag>
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]
        args: [] # optional: list of Conventional Commits types to allow

Install the pre-commit script:

pre-commit install --hook-type commit-msg

Make a (normal) commit ❌:

$ git commit -m "add a new feature"

[INFO] Initializing environment for ....
Conventional Commit......................................................Failed
- hook id: conventional-pre-commit
- duration: 0.07s
- exit code: 1

[Commit message] add a new feature

Your commit message does not follow Conventional Commits formatting
https://www.conventionalcommits.org/

Conventional Commits start with one of the below types, followed by a colon,
followed by the commit message:

    build chore ci docs feat fix perf refactor revert style test

Example commit message adding a feature:

    feat: implement new API

Example commit message fixing an issue:

    fix: remove infinite loop

Optionally, include a scope in parentheses after the type for more context:

    fix(account): remove infinite loop

Make a (conventional) commit ✔️:

$ git commit -m "feat: add a new feature"

[INFO] Initializing environment for ....
Conventional Commit......................................................Passed
- hook id: conventional-pre-commit
- duration: 0.05s

Versioning

Versioning generally follows Semantic Versioning.

In addition to the strict version tag, we also maintain a "latest" tag for each major version, e.g. v1 always points to the latest v1.x.x tag.

License

Apache 2.0

Inspired by matthorgan's pre-commit-conventional-commits.

About

A pre-commit hook that checks commit messages for Conventional Commits formatting

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%