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

Interactive --retry (prefill with previous attempt information)

Open lwouis opened this issue 7 years ago • 8 comments

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.

lwouis avatar May 23 '18 19:05 lwouis

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.

jimthedev avatar May 24 '18 02:05 jimthedev

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 avatar May 24 '18 02:05 jimthedev

@jimthedev I'd be happy to take a crack at this. Is this assigned to anyone?

visheshd avatar Jun 05 '19 07:06 visheshd

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

markov00 avatar Aug 22 '19 23:08 markov00

Hello, any progress on this? I just lost a commit and I turned into a raging barbarian for a few seconds.

irian-codes avatar Nov 12 '24 17:11 irian-codes

@irian-codes Looks like somethings been added..

https://github.com/commitizen/cz-cli/blob/3c08866d9a8788c25798035f2dee7feaa6c03287/README.md?plain=1#L286

waynevanson avatar Nov 20 '24 12:11 waynevanson

@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

irian-codes avatar Nov 20 '24 14:11 irian-codes

This would be great to have! It would be allow us to confirm everything before firing off the commit attempt.

apetta avatar Feb 09 '25 20:02 apetta