Skip to content

Instantly share code, notes, and snippets.

@voodoohop
Last active September 30, 2024 12:43
Show Gist options
  • Save voodoohop/dc362804e835f3d2582734976589665f to your computer and use it in GitHub Desktop.
Save voodoohop/dc362804e835f3d2582734976589665f to your computer and use it in GitHub Desktop.
One-Liner Using ChatGPT for Concise, Automated Git Commit Messages
# install
pip install shell-gpt
sgpt "hi" (and enter your API key)
# commit the current folder with the generated message
git commit . -m "$(git diff | sgpt --model gpt-4o --code 'Write concise, informative commit messages: Start with a summary in imperative mood, explain the 'why' behind changes, keep the summary under 50 characters, use bullet points for multiple changes, avoid using the word refactor, instead explain what was done, and reference related issues or tickets. What you write will be passed to git commit -m "[message]"')"
# you could assign an alias now if you like it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment