Code Monkey home page Code Monkey logo

commitgpt's Introduction

CommitGPT ๐Ÿค–

CommitGPT is a command-line tool that generates a commit message based on the changes in the git diff, following the conventional commits standard.

Installation ๐Ÿš€

To install Commit GPT, you need to have Go installed on your system. Then, you can run the following command:

go install github.com/loadfms/commitgpt@latest

To configure your access and preferences, run:

commitgpt auth

If you dont have a key already, visit Api Keys

Usage ๐Ÿ’ป

To generate a commit message, navigate to the root directory of your git repository and run the following command:

git commit -m "$(commitgpt)"

# OR

commitgpt "Commit my changes"

Commit GPT will analyze the changes in the git diff and generate a commit message based on the conventional commits standard.

PRO TIP: create alias on your .zshrc with command

alias cgpt='git commit -m "$(commitgpt)"'

Sample of Usage โšก

$ git add .

$ cgpt

$ git push

# OR

$ commitgpt "Commit this stuff and push my branch to origin"

commitgpt:
  Here are the commands to execute:

  git add README.md
  git add services/CommandsService.go
  git add models/Constants.go
  git add services/PromptServive.go
  git commit -m ":robot: chore: upgrade interactive mode"
  git push -u origin feat/upgrading-interactive-mode

  Do you want to apply it? [y/n/r]:

Interactive Mode ๐Ÿง 

You can also run CommitGPT in interactive mode by using the -i flag or, by default, just writing what you need to CommitGPT. In this mode, you just need to ask to GPT do something, and it will do it for you.

commitgpt "Commit this stuff and create a new tag v1.2.0"

# OR

commitgpt -i "Commit this stuff and create a new tag v1.2.0"

Boom! Commit GPT will create a commit message and a tag for you. Note: The interactive mode is still in development and may not work as expected in some cases. Also, take care with this, because it will really execute the command you ask for.

Uninstall ๐Ÿ”ฅ

To uninstall just remove the bin file from your $GOPATH/bin

rm $GOPATH/bin/commitgpt

Conventional Commits ๐Ÿ“

The conventional commits standard is a lightweight convention on top of commit messages. It provides an easy way to communicate the nature of changes to other developers and tools that work with the repository.

A conventional commit message consists of a type, a scope, and a subject, followed by a body and a footer (optional). Here's an example of a conventional commit message:

    feat(parser): add support for JSON input

    Add support for parsing JSON input in the parser module.

In this example, the type is feat (for a new feature), the scope is parser, and the subject is add support for JSON input. The body provides more details about the changes, and the footer contains optional metadata, such as references to issues or breaking changes. License

CommitGPT is licensed under the MIT license. See the LICENSE file for more information.

commitgpt's People

Contributors

felipeftn avatar loadfms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

felipeftn

commitgpt's Issues

๐Ÿ‘บ OpenAI's limitation on characters limit

What's the issue? ๐Ÿค”

Currently, we have a limitation on CommitGPT abilities to analyze our code changes.
Since OpenAI limits our "tokens" sent, we only have a limited max capacity of characters in our messages. ๐Ÿ’€

I still don't know how many, and a way to work around this, but usually, when I got many files changed, and a big git diff on my local git, OpenAI's API will not allow we to use commitGPT, since we will send a very large message to be encoded and tokenized by them.
Usually, when we try to commitgpt large changes, we will receive a 400 bad request status code from GPT's API.

I assume it only supports git diffs of up to 200 lines of code for now... โœ๏ธ

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.