Skip to content

Instantly share code, notes, and snippets.

@krzyzanowskim
Last active October 31, 2024 20:13
Show Gist options
  • Save krzyzanowskim/a7faf277cd0b88cbff23bd9b52a4bd2a to your computer and use it in GitHub Desktop.
Save krzyzanowskim/a7faf277cd0b88cbff23bd9b52a4bd2a to your computer and use it in GitHub Desktop.
commit-ai
[alias]
# need llm CLI: https://llm.datasette.io/en/stable/
# based on https://gist.github.com/karpathy/1dd0294ef9567971c1e4348a90d69285?permalink_comment_id=5167582#gistcomment-5167582
commit-ai = "!f() { if [ -n \"$(git diff --cached)\" ]; then git commit -m \"$(git diff --cached | llm -m '4o-mini' 'Below is a diff of all staged changes, coming from the command:\\n```\\ngit diff --cached\\n```\\nPlease generate a concise, two-sentence, maximum 100 characteres commit message for these changes. Do not mention project name.')\"; else echo 'No changes to commit'; fi }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment