commitizen / cz-cli

The commitizen command line utility. #BlackLivesMatter
http://commitizen.github.io/cz-cli/
MIT License
16.58k stars 552 forks source link

Comittizen runs twice when using the `prepare-commit-msg` hook #924

Open wujekbogdan opened 2 years ago

wujekbogdan commented 2 years ago

Steps to re-produce

  1. Create a prepare-commit-msg hook:

    #!/bin/sh
    . "$(dirname "$0")/_/husky.sh"
    
    exec < /dev/tty && node_modules/.bin/cz --hook || true
    
  2. Run git commit
  3. Follow the CLI
  4. Everything works as expected.
  5. Run git cz
  6. Follow the CLI
  7. Everything goes as expected except that, after we complete the wizard, Comittizen opens up again.

Is there any way to prevent prepare-commit-msg hook from running when executing git cz?

marcitqualab commented 2 years ago

Same issue here. I have configured all as per the documentation.

marcitqualab commented 2 years ago

This question my be a duplicated on of https://github.com/commitizen/cz-cli/issues/844

atomicrobokid commented 2 years ago

Facing exactly the same issue. Kind of makes the whole interactive prepare-commit-msg a bit pointless. When i've finished the interactive prompt it spits me into gits edit message hook in vim

Zhengqbbb commented 3 months ago

ref: https://github.com/commitizen/cz-cli/issues/934#issuecomment-1982811302

git config --local core.editor cat

image