-
-
Save elsayed85/2f86ca8149f52d3b23a8c97f7af933a7 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