Skip to content

Instantly share code, notes, and snippets.

@zalez
Created December 23, 2025 08:14
Show Gist options
  • Select an option

  • Save zalez/db16b36a7ac34f64825249f4a534cfab to your computer and use it in GitHub Desktop.

Select an option

Save zalez/db16b36a7ac34f64825249f4a534cfab to your computer and use it in GitHub Desktop.
gen-commit-message Fish function for auto-generating commit messages with llm and Claude Haiku
# Prerequisites:
# - llm command line tool: https://github.com/simonw/llm
# - llm-anthropic plugin for llm: https://github.com/simonw/llm-anthropic
# - Anthropic account with access to Claude Haiku models
# - Anthropic API key configured in llm ('llm keys set anthropic')
function gen-commit-message
set prompt "\
Create a git commit message based on the following output from git diff.\
Analyze the git diff output carefully to understand the high level changes to\
the repository, what they mean, and what value they added to the repository.\
Then, craft your git commit message by starting with a short summary (5-10 words),\
followed by a list of main changes as bullet points, and finishing with a funny\
comment at the end. Use emojis and expressive language to make the commit message\
more engaging and fun! Here is the git diff output: \n\n---\n"
git add .
git --no-pager diff --cached | llm --model claude-haiku-4.5 --system "$prompt"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment