CommitGPT is a command-line tool that automatically generates meaningful Git commit messages using Claude AI (Anthropic's API). It analyzes your unstaged changes and creates a concise, descriptive commit message following conventional commit format.
- Automatically detects unstaged Git changes
- Generates semantic commit messages using AI
- Follows conventional commit format (e.g.,
feat:
,fix:
, etc.) - Handles staging and commit creation automatically
Before using CommitGPT, ensure you have:
- Go installed on your system
- Git installed and configured
- An Anthropic API key
- A repository - lol
- Clone the repository:
git clone https://github.com/raphaelluethy/commitgpt
cd commitgpt
- Set up your Anthropic API key as an environment variable:
export ANTHROPIC_API_KEY='your-api-key-here'
- Build the application:
go build -o commitgpt
- (Optional) Add the binary to your PATH for system-wide access.
Simply run CommitGPT in your Git repository when you have changes you want to commit:
./commitgpt
The tool will:
- Check for unstaged changes
- Generate a commit message using Claude AI
- Stage all changes (
git add .
) - Create a commit with the generated message
--help
or-h
: Display help information
$ ./commitgpt
Created commit: feat: add user authentication system with OAuth2 support
The tool will exit with an error message if:
- No unstaged changes are found
- The Anthropic API call fails
- Git operations (staging/committing) fail
ANTHROPIC_API_KEY
: Your Anthropic API key (required)
MIT License. See LICENSE for details.