Skip to main content

A set of tools to validate git Conventional Commit messages.

Project description

Commit Message Git Hook

A set of tools to validate git Conventional Commit messages.

See the Conventional Commits Specification.

Installation Instructions

Install from PyPI (Python Package Index)

Run the script below to install the latest version of this package:

pip install commit-msg-git-hook --upgrade

Setup the Local Git Hook commit-msg

Run the script below to scaffold the hook:

python3 -m commit_msg_git_hook.setup

It does the following steps:

  • Create a directory for git-hooks, by default ./.github/git-hooks.
  • Set the hooks path to the current repository as the created directory.
  • Create the commit-msg hook file.
  • Fill it with a basic script to call commit_msg.main(), from this package.
  • Make the hook file executable.
  • Create a configuration file commit-msg.config.json if it doesn't exist.

Configuration Instructions

Customize the configuration file commit-msg.config.json to fit your project's needs.

Probably you will want to add scopes, to fully utilize the Conventional Commits Specification.

Basic Usage

After setting up and adding the new files to your git remote repository, your collaborators will need to run the installation and setup steps again. But, this time, the setup will only set the hooks path and make sure the file commit-msg is executable.

Every time you make a commit, the hook will check if its message is in accordance to the specification and the project's customization.

How To Edit Commits

If your branch is not shared yet (not merged into develop, for example), you can edit your commits with the command below. Git will list the last n commits and ask you whether you want to keep or edit each one of them.

git rebase -i HEAD~n

More information here: https://docs.github.com/pt/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commit_msg_git_hook-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commit_msg_git_hook-0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file commit_msg_git_hook-0.1.1.tar.gz.

File metadata

  • Download URL: commit_msg_git_hook-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for commit_msg_git_hook-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f5516f61244e44f667cb46c42ef330d5949d2637c2becdc73a4c544beb909d87
MD5 9a4782e52de2464e28c0c03cc59e603c
BLAKE2b-256 23e37a13d627b07ed29556797368aa2966c51abf28a052bfe8fc938fd35b0f50

See more details on using hashes here.

File details

Details for the file commit_msg_git_hook-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for commit_msg_git_hook-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ca02fc02a2e0291837cc25b93fcf74e654caf948310c4c59bd318f80cd6d6e2
MD5 4e8a821454259805024d0586075a103f
BLAKE2b-256 171e40215721789e4b75bb686b7bc0ca2bfc983a88b615f3b4368de7d7e71363

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page