CodeGPT icon indicating copy to clipboard operation
CodeGPT copied to clipboard

Make `codegpt commit` command trigger the git pre-commit hook

Open k0286 opened this issue 2 years ago • 7 comments

Hi,

I hope the codegpt commit can trigger the git pre-commit hook, before generate the commit message.

I know I can install the prepare-commit-hook to the project. But I don't want to use codegpt for every commit.

So I prefer to use codegpt commit when it's needed.

感謝!

k0286 avatar Nov 10 '23 08:11 k0286

@k0286 CodeGPT already have git prepare-commit-msg hook built-in. Just try codegpt hook install to install the hook.

Can you describe more about your requirements? I don't really get what you want.

doggy8088 avatar Dec 03 '23 16:12 doggy8088

Thx for your replay.

E.g. I don't want to codegpt been triggered when running git rebase.

But If the prepare-commit-msg hook is intstalled, I don't have any option to disable it except uninstall the hook.

k0286 avatar Dec 05 '23 07:12 k0286

Reference from this: https://stackoverflow.com/a/57590865/910074

git rebase runs pre-rebase and post-rewrite hooks. Are you sure your git rebase will trigger prepare-commit-msg hook?

doggy8088 avatar Dec 05 '23 07:12 doggy8088

Reference from this: https://stackoverflow.com/a/57590865/910074

git rebase runs pre-rebase and post-rewrite hooks. Are you sure your git rebase will trigger prepare-commit-msg hook?

Of course, if you met the conflicts when doing rebase process.

k0286 avatar Dec 07 '23 00:12 k0286

I got your point now.

So why do you want to trigger the git pre-commit hook when running codegpt commit? I don't understand why you have to run codegpt commit during git rebase if there is a conflict happen.

doggy8088 avatar Dec 11 '23 18:12 doggy8088

Yeah, you are right. I actually don't want to codegpt commit been triggered during I'm solving the conflicts. But It triggers if the codegpt commit hook is installed. There are no options to bypass the prepre-commit-message hook, right?

k0286 avatar Dec 12 '23 00:12 k0286

@appleboy Do you have any idea?

doggy8088 avatar Dec 22 '23 01:12 doggy8088