appleboy / CodeGPT

A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4o, gpt-4-turbo, gpt-3.5-turbo model) and automatically installs a git prepare-commit-msg hook.
MIT License
1.16k stars 100 forks source link

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

Open k0286 opened 8 months ago

k0286 commented 8 months ago

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.

感謝!

doggy8088 commented 7 months ago

@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.

k0286 commented 7 months ago

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.

doggy8088 commented 7 months ago

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?

k0286 commented 7 months ago

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.

doggy8088 commented 7 months ago

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.

k0286 commented 7 months ago

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?

doggy8088 commented 6 months ago

@appleboy Do you have any idea?