Skip to content

Instantly share code, notes, and snippets.

View sergebulaev's full-sized avatar

Sergey Bulaev sergebulaev

View GitHub Profile
@sergebulaev
sergebulaev / add_to_zshrc.sh
Last active October 1, 2024 11:25 — forked from karpathy/add_to_zshrc.sh
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this function into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) Checks if there are any staged changes
# 2) Gets the current staged changes diff
# 3) Sends the diff to an LLM to generate a structured summary of changes
# 4) Sends the diff to an LLM to write a git commit message
# 5) Allows you to easily accept, edit, regenerate, or cancel the commit
# 6) Provides timestamp for successful commits or cancellations
#
@karpathy
karpathy / add_to_zshrc.sh
Created August 25, 2024 20:43
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# But - just read and edit the code however you like
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/
gcm() {