AI generated commit messages

ai
git
code
automation
AI commits
AI commits © BechBox
Published on 13th November, 2022 by Mikkel Bech

Commit messages can be tedious to come up with and I found a better way (for me at least) to do it, so here's how I do git commits by just hitting CMD-enter in VS Code. AI generates the commit message and to be frank, it does a better job than me at it

1. Install auto-commit with:

1curl -fsSL https://raw.githubusercontent.com/m1guelpf/auto-commit/main/install.sh | sh -

2. add OpenAI API key to .zshrc (or whatever terminal you're using)

export OPENAI_API_KEY='sk-XXXXXXXX'

3. create a file called auto-push.sh and make sure it's location is in your path

1git add . && \
2auto-commit && \
3git push

(if you want to include deletes in your commits as well use git add -A instead of git add .)

4. Use the "Command Runner" extension in Visual Studio Code" and add this shortcut to preference > keyboard shortcuts:

1{
2    "key": "cmd+enter",
3    "label": "generate commit and push",
4    "command": "command-runner.run",
5    "args": {"command": "sh auto-push.sh"},
6    "when": "editorTextFocus"
7}

5. Make some changes to your code and hit CMD+enter. Auto-commit will make a suggestion for the commit message and if you're satisfied just hit Y

Mikkel Bech
Author
Mikkel Bech

I'm a Designer, Developer, Photographer, 3D Generalist, Musician kind of guy

Read more on the About page