Giter Site home page Giter Site logo

ai-commit's Introduction

upvote

Preview

View Demo

ai-commit

No more headaches with commit messages.

AI-Commit is a command line tool that uses OpenAI's ChatGPT model to generate commit messages for your Git repositories. As a result, you can write meaningful commit messages without having to think about them.

Prerequisites

To use AI-Commit, you need to obtain an API key from OpenAI and set it as the value of the OPENAI_API_KEY environment variable.

export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Sometime, the ChatGPT's response is not good (too long, too short, not meaningful). In that case, you can try custom the system prompt by set the AI_COMMIT_SYSTEM_PROMPT environment variable:

export AI_COMMIT_SYSTEM_PROMPT="You are a GitCommitGPT-4, You will help user to write commit message, commit message should be short (less than 100 chars), clean and meaningful. Only response the message."

By default, ai-commit use model gpt-3.5-turbo. You can change it by set the AI_COMMIT_MODEL environment variable:

export AI_COMMIT_MODEL="gpt-3.5-turbo"

Note: Using AI-Commit will result in charges from OpenAI for API usage, so be sure to understand their pricing model before use.

Install

There are two ways to install AI-Commit:

Use go

go install github.com/nguyenvanduocit/ai-commit@latest

Prebuilt binaries

You can download prebuilt binaries for Linux, macOS, and Windows from the releases page

Usage

  1. Stage the changes you want to commit in Git.
  2. Run ai-commit command.
  3. The tool will generate a commit message and print it to the console.
  4. Now you can chat with the AI to adjust the commit message. Press ctrl + c to stop.
  5. Finally, select the type of commit.

Auto commit, no interaction

When use -a flag, ai-commit will auto stage all changes then commit with generated message.

ai-commit -a

Auto tag

When use -t flag, ai-commit will auto create tag based on the commit messages between the last tag and the HEAD.

ai-commit -t

Auto push

When use -p flag, ai-commit will auto push to remote.

ai-commit -p

Todo

  • Auto split changes in to multiple commits.
  • Detect commit type.
  • Auto tags?

License

AI-Commit is released under the MIT license. See LICENSE for more information.

Contributing

Contributions are welcome! Please read the contribution guidelines first.

update

ai-commit's People

Contributors

actions-user avatar nguyenvanduocit avatar tobi-de avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ai-commit's Issues

Set up environment variable

How do I even set up the OPENAI_API_TOKEN environment variable.
It will be great if you guys include the steps to setup the environment variable into your README.md file

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.