Last active
December 18, 2022 22:38
-
-
Save bplunkert/f25202a731ca25e7ab9edd5b9ed2ce79 to your computer and use it in GitHub Desktop.
GPT writes commit messages for you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This file goes in .git/hooks/commit-msg | |
set -e | |
git_diff=$(cat "$1") | |
prompt="I want you to help me write a commit message. When I send the output of git diff, I want you to send only a suggested git commit message (only the message, no commands, nothing else), and do not send any explanation or anything else with it. Here is the git diff:\n${git_diff}" | |
(echo "$prompt") | openai complete - >> "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment