Git Product home page Git Product logo

opencommit's Introduction

OpenCommit logo

OpenCommit

Follow the bird

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

  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

Internationalization support

To specify the language used to generate commit messages:

# de, German ,Deutsch
oc config set language=de
oc config set language=German
oc config set language=Deutsch

# fr, French, française
oc config set language=fr
oc config set language=French
oc config set language=française

The default language set is English
All available languages are currently listed in the i18n folder

Git flags

The opencommit or oc commands can be used in place of the git commit -m "${generatedMessage}" command. This means that any regular flags that are used with the git commit command will also be applied when using opencommit or oc.

oc --no-verify

is translated to :

git commit -m "${generatedMessage}" --no-verify

Ignore files

You can ignore files from submission to OpenAI by creating a .opencommitignore file. For example:

path/to/large-asset.zip
**/*.jpg

This is useful for preventing opencommit from uploading artifacts and large files.

By default, opencommit ignores files matching: *-lock.* and *.lock

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

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 (3.5-turbo) official model, that is ~15x times cheaper than GPT-4.

opencommit's People

Contributors

adrielbento avatar alexcgomez avatar art0rz avatar bennycode avatar di-sukharev avatar ericklima-ca avatar esmerlinjm avatar imload avatar ingwarsw avatar jeroensmink98 avatar jessicakuijer avatar kimlym avatar kmmaniez avatar l2d avatar linhdangquang avatar manato1fg avatar mathsgod avatar matt-degraffenreid avatar moret84 avatar nader-zouaoui avatar openefit avatar sectex avatar the-r4v3n avatar vladickweb avatar zankyr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.