cz-cli icon indicating copy to clipboard operation
cz-cli copied to clipboard

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

Open wujekbogdan opened this issue 3 years ago • 4 comments

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?

wujekbogdan avatar Apr 16 '22 09:04 wujekbogdan

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

marcitqualab avatar Apr 29 '22 09:04 marcitqualab

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

marcitqualab avatar Apr 29 '22 09:04 marcitqualab

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

atomicrobokid avatar May 10 '22 18:05 atomicrobokid

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

git config --local core.editor cat

image

Zhengqbbb avatar Mar 13 '24 15:03 Zhengqbbb