git-gen
is a command-line tool developed in Go that generates commit messages and code reviews based on code changes in your project by utilizing OpenAI's ChatGPT API and Ollama API.
git-gen
is designed to assist developers in creating detailed commit messages and/or performing code reviews automatically depending on their codebase changes. By leveraging the power of ChatGPT and Ollama, git-gen
analyzes the changes made to the code and generates meaningful output.
- Generate commit messages based on code changes.
- Performs detailed code reviews.
To get started with git-gen
, you need to have Go installed on your machine. You can download and install Go from here.
Once Go is installed, you can clone the git-gen
repository and build the tool:
git clone https://github.com/seymahandekli/git-gen
cd git-gen
go build ./cmd/git-gen
./git-gen register
You can install the package should put the /usr/local/go/bin directory in your PATH environment variable.
go install github.com/seymahandekli/git-gen/cmd/git-gen@latest
After building git-gen
, you can use it from the command line. Below are some example commands to help you get started:
# Generate commit message based on your git diff command choices (default platform: openai)
git gen commit --source "commitID" --dest "commitID" --apikey "PLATFORM_API_KEY" --platform openai --model YOUR_MODEL
# default `git diff HEAD´ command
git gen commit --apikey "PLATFORM_API_KEY"
# Generate code review
git gen review --apikey "PLATFORM_API_KEY"
You don't have to specify OPENAI API KEY explicitly, you may store it to PLATFORM_API_KEY
environment variable.
export PLATFORM_API_KEY="PLATFORM_API_KEY"
# Generate commit message based on your git diff command choices (default platform: openai and default model: gpt4-o)
git gen commit --source "commitID" --dest "commitID"
# default `git diff HEAD´ command
git gen commit
# Generate code review
git gen review
You can use the Ollama API, which does not require an API key, for free
# Generate commit message based on your git diff command choices (default model: llama3)
git gen commit --source "commitID" --dest "commitID" --platform ollama --model YOUR_MODEL
# default `git diff HEAD´ command
git gen commit --platform ollama --model YOUR_MODEL
# Generate code review
git gen review --platform ollama --model YOUR_MODEL
For more detailed usage instructions, refer to the --help
option:
# General usage
git gen --help
# Help for commit messages feature
git gen commit --help
# Help for code review feature
git gen review --help
We welcome contributions from the community! If you'd like to contribute to git-gen
, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them with clear messages.
- Push your changes to your fork.
- Submit a pull request to the
main
branch of this repository.
For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Eser Özvataf (https://github.com/eser)
- Daniel M. Matongo (https://github.com/mmatongo)
I would like to thank people below for their support and contributions:
- Arda Kılıçdağı (http://github.com/Ardakilic)
- Erman İmer (https://github.com/ermanimer)
- Eser Özvataf (https://github.com/eser)
We hope you find git-gen
useful! If you have any questions or feedback, please feel free to open an issue on GitHub.
Happy coding!