You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: ensure git commit --amend works with prepare-commit-msg hook (#179)
When the generated message quality is not good, I use `codegpt commit --amend` to regenerate the message.
**But there are still small parts that need to be modified manually.**
Using `git commit --amend` in the current version will cause the following error:
```
Error: please add your staged changes using git add <files...>
```
So I modified the `git/templates/prepare-commit-msg` file, so that `codegpt` is not executed when `git commit --amend` is used.
See the Git Hooks [documentation](https://git-scm.com/docs/githooks#_prepare_commit_msg)
> The second is the source of the commit message, and can be: message (if a -m or -F option was given); template (if a -t option was given or the configuration option commit.template is set); merge (if the commit is a merge or a .git/MERGE_MSG file exists); squash (if a .git/SQUASH_MSG file exists); or commit, followed by a commit object name (if a -c, -C or --amend option was given).
0 commit comments