Skip to content

GPT CLI to auto-generate impressive commits in 1 second 🤯🔫

License

Notifications You must be signed in to change notification settings

Lars-/opencommit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCommit logo

OpenCommit

Author @di-sukharev

GPT CLI to auto-generate impressive commits in 1 second

Killing lame commits with AI 🤯🔫

Current version

OpenCommit example

All the commits in this repo are done with OpenCommit — look into the commits to see how OpenCommit works. Emoji and long commit description text is configurable.

Setup

The minimum supported version of Node.js is the latest v14. Check your Node.js version with node --version.

  1. Install opencommit globally to use in any repository:

    npm install -g opencommit
  2. Get your API key from OpenAI. Make sure you add payment details, so API works.

  3. Set the key to opencommit config:

    opencommit config set OPENAI_API_KEY=<your_api_key>

    Your api key is stored locally in ~/.opencommit config file.

Usage

You can call opencommit directly to generate a commit message for your staged changes:

git add <files...>
opencommit

You can also use the oc shortcut:

git add <files...>
oc

Features

Preface commits with emoji 🤠

GitMoji convention is used.

To add emoji:

oc config set emoji=true

To remove emoji:

oc config set emoji=false

Postface commits with descriptions of changes

To add descriptions:

oc config set description=true

To remove description:

oc config set description=false

Git hook

You can set opencommit as Git prepare-commit-msg hook. Hook integrates with you IDE Source Control and allows you edit the message before commit.

To set the hook:

oc hook set

To unset the hook:

oc hook unset

In the hook, there is a check that checks if the commit message is not empty. If it is not, the hook will not run. To skip that check and always replace the commit message run:

oc config set skipCommitMsgHookSourceCheck=true

To use the hook:

git add <files...>
git commit

Or follow the process of your IDE Source Control feature, when it calls git commit command — OpenCommit will integrate into the flow.

Payments

You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT official model, that is ~10x times cheaper than GPT-3.

About

GPT CLI to auto-generate impressive commits in 1 second 🤯🔫

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.3%
  • JavaScript 3.7%