One-liner to automate your Git commit messages using ChatGPT

2 points by thomashop ↗ HN

  # 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 --code 'Based on the changes above, generate an expertly crafted concise commit message following best practices')"

2 comments

[ 3.3 ms ] story [ 11.0 ms ] thread
I did not know you could inject code into a commit message. Wow that’s terrifying
Bash runs the code before and then calls git commit.