Nurbol Alpysbayev
Nurbol Alpysbayev

Reputation: 21931

Commitizen: Is there a way to override standard `git commit`?

Any commitizen users here?

Wanted behavior:

  1. install commitizen
  2. run git commit
  3. see the same nice menu as when running git cz

Current behavior:

  1. install commitizen
  2. run git commit
  3. NO nice menu as when running git cz, just default git interface

Upvotes: 6

Views: 7409

Answers (2)

Thikron
Thikron

Reputation: 86

yes you can do it with the git hooks. Just do the following as it is written on the https://commitizen.github.io/cz-cli/ site.

Add in the file .git/hooks/prepare-commit-msg (if the file is not present just create it) in your root folder of the project following lines:

#!/bin/bash exec < /dev/tty && node_modules/.bin/git-cz --hook || true

If the file is already there just add the exec line and git commit will now show the same menu as when git cz.

Upvotes: 5

VonC
VonC

Reputation: 1327304

The commitizen/cz-cli project suggests:

Now, simply use git cz instead of git commit when committing.

If git-cz is in your PATH, you can call git cz. But it won't overshadow git commit, simply offer a different alternative.

Upvotes: 0

Related Questions