/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.

Primary LanguageGoMIT LicenseMIT

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.