Generate commit messages from diff #293
Closed
dufferzafar
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
To generate git commit message, we can use default Shell GPT role. Just pipe the git diff | sgpt "Generate git commit message for my changes" But if you need something more specific you can make a new role for it:
|
Beta Was this translation helpful? Give feedback.
2 replies
-
cgpt() {
commit_msg=$(git diff --staged | sgpt --model="gpt-3.5-turbo" "Write one commit message based on the changes. First letter uppercase, present tense. Your output is directly fed into the command!")
echo -n "Generated Message: \n $commit_msg \n Is this message ok? [y/n]: "
read confirm
if [[ $confirm == "y" || $confirm == "Y" ]]; then
git commit -m "$commit_msg"
fi
} I've just added this to my |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's a bunch of tools around automating the generation of commit messages using GPT.
For eg:
https://github.com/RomanHotsiy/commitgpt/blob/main/template.ts
Being able to do this via shell_gpt itself would be great.
Looking at the code, would I need to create a new role or a new handler?
Beta Was this translation helpful? Give feedback.
All reactions