question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `pre-commit` hook that will run Commitizen on `git commit`

See original GitHub issue

Background

pre-commit is a package manager for git hooks. The project allows hooks to be downloaded locally and run in an isolated environment. This allows for easy adoption of hooks written in a variety of languages and allows for quick adoption by contributors who are unfamiliar with any particular hook.

Possible Solution

This project can make itself pre-commit compatible by adding a .pre-commit-hooks.yaml file. You can use this file to make your existing prepare-commit-msg hook and the Commitizen project as a whole more accessible.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:14

github_iconTop GitHub Comments

3reactions
paulmboycecommented, Feb 10, 2021

Hi @ShaneKosieradzki , if it helps, you can use husky to run pre commit hooks.

Install husky:

npm install--save-dev husky

Then run this to add a pre commit message hook:

npx husky add .husky/prepare-commit-msg "exec < /dev/tty && git cz --hook || true"

Note, you will probably want to add the resulting hook file to git:

.husky/prepare-commit-msg

I know that isn’t enhancing commitizen itself, but it does get you the pre commit hooks

Hope that helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supported hooks - pre-commit
forbid-autopkg-trust-info - This hook prevents AutoPkg recipes with trust info from being added to the repo. munki-makecatalogs - This hook runs the " ......
Read more >
Contributing - Commitizen
Clone the repository from your GitHub. Setup development environment through poetry ( poetry install ). Setup pre-commit hook ( pre-commit install -t pre-commit...
Read more >
Making commits the right way with hooks - DEV Community ‍ ‍
"husky": { "hooks": { "pre-commit": "echo Hello World!" } } You can add any git-hooks within hooks .
Read more >
How to use the latest Husky 8 with Commitizen for adding git ...
I've been trying to setup Husky with Commitizen to add git hooks to my project. ... The pre-commit hook is run before we...
Read more >
Git hooks with husky & commitlint - Techiediaries
We can utilize Husky to add a git hook to the commit command. Head over to your command-line interface, make sure you navigate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found