Skip to content

Instantly share code, notes, and snippets.

View gigq's full-sized avatar

Justin Sanders gigq

View GitHub Profile
@gigq
gigq / gptcommit.sh
Created March 25, 2023 18:52
Quick bash script using gpt-ai (https://github.com/lmatosevic/chatgpt-cli) to read git diff and create a commit message
#!/bin/bash
git add .
# Run git diff and capture the output, excluding yarn.lock for js/ts projects
diff_output=$(git diff HEAD -- . ':(exclude)yarn.lock')
# Prepend the commit message to the diff output
commit_message="Output just a properly formatted git commit message from the following, be accurate and concise, no need to specify prefixes, don't assume why changes were made:"
full_output="$commit_message\n\n$diff_output"