6

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
Nurbol Alpysbayev
  • 19,522
  • 3
  • 54
  • 89
  • 2
    You'd have to frontend the `git` command, say as a shell function, and do your own prepass on the args to do your own subcommand lookup. There are many reasons this tool you're using doesn't offer that itself already, despite it being easy to implement. Scripts written with the native git commands would become impossible, for starters. – jthill Aug 16 '18 at 03:31
  • Thanks! I actually tried this approach, however with no success. Anyway, things got dirty and not cross-platform, so I gave up with it and searching for another way. – Nurbol Alpysbayev Aug 16 '18 at 03:35

2 Answers2

5

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.

Thikron
  • 86
  • 1
  • 3
0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250