Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lguibr/commitai
CommitAI is a command-line tool that helps you generate informative and relevant commit messages for your Git repositories using GPT-4 by OpenAI. It analyzes your staged changes, combines it with a high-level explanation provided by you, and creates a commit message based on this information
https://github.com/lguibr/commitai
commit git gpt gpt-4
Last synced: 4 months ago
JSON representation
CommitAI is a command-line tool that helps you generate informative and relevant commit messages for your Git repositories using GPT-4 by OpenAI. It analyzes your staged changes, combines it with a high-level explanation provided by you, and creates a commit message based on this information
- Host: GitHub
- URL: https://github.com/lguibr/commitai
- Owner: lguibr
- Created: 2023-03-30T22:36:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T17:03:23.000Z (10 months ago)
- Last Synced: 2024-05-28T15:06:33.329Z (9 months ago)
- Topics: commit, git, gpt, gpt-4
- Language: Python
- Homepage:
- Size: 2.67 MB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CommitAi - Your AI-Powered Commit Assistant
[](https://github.com/lguibr/commitai/actions)
[](https://codecov.io/gh/lguibr/commitai)
[](https://pypi.org/project/CommitAi/)
[](https://pypi.org/project/CommitAi/)
[](https://github.com/lguibr/CommitAi/blob/main/LICENSE)**CommitAi** simplifies the Git commit message creation process by leveraging AI technologies, including GPT-4 and Claude. Designed for developers who value clarity and precision in commit histories, **CommitAi** offers a streamlined workflow that transforms your staged changes and high-level explanations into informative commit messages. Enhance your project documentation and streamline your development process with commit messages that truly reflect your changes.
## Demo

This demo GIF shows CommitAi in action, demonstrating how it generates a commit without any additional input, using Claude 3 Opus.
## Features
- **Intelligent Commit Generation**: Leverages state-of-the-art AI models to generate meaningful commit messages from your changes.
- **Pre-commit Checks**: Automatically runs configured pre-commit hooks to ensure quality and consistency before generating messages.
- **Template Support**: Utilizes both global and repository-specific commit message templates to maintain a consistent style across your projects.
- **AI Model Integration**: Supports multiple AI models, including GPT-4 by OpenAI and Claude by Anthropic, ensuring versatility in natural language processing capabilities.## Getting Started
### Prerequisites
- Python 3.6 or later
- API keys for GPT-4 and Claude, as required### Installation
Install **CommitAi** directly from PyPI:
```bash
pip install commitai
```### Configuration
#### API Keys
Set the necessary API keys as environment variables:
```bash
export OPENAI_API_KEY="your_openai_api_key"
export ANTHROPIC_API_KEY="your_anthropic_api_key"
```#### Commit Templates
Set a global commit template environment variable:
```bash
export TEMPLATE_COMMIT="My global custom template: {message}"
```Or, create a repository-specific template using:
```bash
commitai-create-template "My repository-specific template: {message}"
```This creates a hidden template file within the `.git` directory of your repository.
## Usage
To generate a commit message, provide a high-level explanation of your changes:
```bash
commitai "This is a high-level explanation of my commit"
```#### Options
- `-a, --add`: Stage all changes before generating the commit message.
- `-c, --commit`: Automatically create the commit using the generated message.
- `-t, --template`: Specify a commit template. Defaults to the global template if available.
- `-m, --model`: Choose the AI model (`gpt-4` by default).### Additional Commands
- `commitai-create-template`: Set a custom template specific to your repository.
## Contributing
Contributions are welcome! Feel free to fork the repository, push your changes to a branch, and open a pull request. For bugs, questions, or feature requests, please open an issue through the GitHub issue tracker.
## License
**CommitAi** is open-source software licensed under the MIT License. See the [LICENSE](https://github.com/lguibr/CommitAi/blob/main/LICENSE) file for more details.