From 6ec70b3a9678e9ec72d9af20f4f459b8faad82a0 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Tue, 27 Aug 2024 11:42:43 -0700 Subject: [PATCH] Add git-ai-message script for AI-generated commit messages Introduces a new script that uses an LLM to generate commit messages based on the staged diff and current branch name. --- git-ai-message | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 git-ai-message diff --git a/git-ai-message b/git-ai-message new file mode 100755 index 0000000..627eb6c --- /dev/null +++ b/git-ai-message @@ -0,0 +1,7 @@ +#!/bin/zsh + +BRANCH=$(git rev-parse --abbrev-ref HEAD) +DIFF=$(git diff --staged) +if [[ -n "$DIFF" ]]; then + llm "Write a code commit message for this diff on the branch $BRANCH and only output the message itself so it can be used directly to commit. Include a one-line summary, and optionally a description below that if there are lots of changes. Be concise and avoid adding fluff or filler. Wrap the description at 70 characters per line.\n\n\`\`\`\n$DIFF\n\`\`\`" +fi