cz-cli
cz-cli copied to clipboard
Interactive --retry (prefill with previous attempt information)
I have some git pre-commit hooks in my projects. If they fail after git cz is run, then I can either run git cz again, and fill everything again, or I can run it with git cz --retry, but in that case if the issue was with my commit message not being valid (against commintlint for instance) it will just fail again.
It would be nice to have git cz be pre-filled with text from last try. So I could just come back and edit it then it would pass the second time.
I can imagine someone not knowing about .git/COMMIT_EDITMSG writting a nice commit message with a long description (describing a complex breaking change for example), and feeling devastated when they forgot something that breaks commintlint, and they think they lost their work. This doesn't happen with git commit -m "" because most people use their terminal history to recover the previous git commit command with their message.
I think this is a greattttt idea. I'd love to have it as a feature. I think it would be a matter of us somehow telling the adapters what default values they should show the user when a commit is triggered. Then, when someone uses --retry-filled or something like that, the adapters would provide the original commits as defaults to inquirer.js which is what most of them use for prompts.
With that said I have multiple ongoing projects and a 2 month old that is stopping me from implementing this but I would 100% merge PRs for this in this project. The cool thing is that we could put this functionality into the cli first and just find a way to pass this information to the adapters so that they can render the pre-filled prompts.
@jimthedev I'd be happy to take a crack at this. Is this assigned to anyone?
It will be also very useful, for the --retry option, to show the commit message before start the pre-commit hooks etc so you are really sure about what is the commit message that will be used.
I think showing the commit just below the Retrying last commit attempt. text will be great and very useful
Hello, any progress on this? I just lost a commit and I turned into a raging barbarian for a few seconds.
@irian-codes Looks like somethings been added..
https://github.com/commitizen/cz-cli/blob/3c08866d9a8788c25798035f2dee7feaa6c03287/README.md?plain=1#L286
@irian-codes Looks like somethings been added..
https://github.com/commitizen/cz-cli/blob/3c08866d9a8788c25798035f2dee7feaa6c03287/README.md?plain=1#L286
It works! Thanks!
This issue I think it can be closed
This would be great to have! It would be allow us to confirm everything before firing off the commit attempt.