Git Prompt Tool is a CLI tool that helps you write commit messages using AI through OpenRouter or a local LLM. It acts as a complete git wrapper, enhancing specific commands with AI while passing through all other git commands directly.
-
Acts as a complete git replacement - all git commands are supported
-
Generate commit messages with AI based on your code changes
gitpt commit
-
Create pull requests with AI-generated titles and descriptions
gitpt pr create
-
Compatible with all regular git options (flags, arguments, etc.)
-
Edit suggested messages before committing
-
Works with various AI models via OpenRouter
-
Support for local LLMs with OpenAI-compatible API
-
Commitlint support - read directly from your repository
To configure GitPT with your OpenRouter API key and select a model:
This will guide you through:
- Entering your OpenRouter API key
- Selecting an AI model from popular options or specifying a custom one
It's recommended using small models, such as openai/gpt-4.1-mini as your model choice. Mainly due to its large context window, fast response times & cost-effective pricing.
You'll need an OpenRouter account to get an API key.
GitPT can be used as a direct replacement for git - any git command can be run through GitPT:
Add files to the staging area just like you would with git:
Generate an AI-powered commit message based on your staged changes:
The tool will:
- Analyze your staged changes
- Generate a commit message using the configured AI model
- Validate against commitlint rules (if configured)
- Regenerate the message if it fails validation
- Show you the suggested message
- Let you edit the message before committing
- Create the commit with your approved message
You can change the AI model at any time:
It's recommended using small models, such as openai/gpt-4.1-mini as your model choice. Mainly due to its large context window, fast response times & cost-effective pricing.
GitPT works with any local LLM that provides an OpenAI-compatible API endpoint, such as:
If you have GitHub CLI (gh) installed, you can use GitPT to interact with GitHub (e.g. generate full pull requests).
Generate AI-powered pull request titles and descriptions based on your changes:
The tool will:
- Analyze the commits and files changed since branching from the base branch
- Generate a suitable PR title and detailed description
- Show you the suggested content
- Let you edit the title and description before submission
- Create the pull request with your approved content
GitPT leverages AI to enhance your Git workflow while acting as a complete git wrapper:
-
Command Handling: GitPT intelligently routes commands - enhanced commands (commit, pr) use AI capabilities while all other git commands are passed directly to git.
-
For commits: Sends a diff of your staged changes to the AI, which generates a contextual commit message following best practices.
-
Commitlint Integration: Automatically detects commitlint configuration files and validates generated commit messages against your project's commit conventions. If validation fails, it regenerates a compliant message.
-
For pull requests: Analyzes the commits and file changes between your branch and the base branch, then generates a suitable title and detailed description for your PR.
-
For other git commands: Passes them through directly to git with all arguments and options preserved, ensuring complete compatibility with your existing git workflow.
-
Local LLM Support: Can use locally running LLM servers with OpenAI-compatible APIs instead of cloud-based services, providing privacy and offline capabilities.
GitPT automatically detects and integrates with commitlint if it's configured in your repository:
-
Automatic Detection: GitPT checks for common commitlint configuration files (commitlint.config.js, .commitlintrc.*, etc.)
-
Rule-Aware Generation: When commitlint is detected, GitPT instructs the AI to generate messages that follow your specific commit conventions
-
Validation & Regeneration: Generated messages are validated against your commitlint rules before committing. If validation fails, GitPT automatically regenerates a compliant message
-
Error Feedback: Validation errors are sent to the AI to help it understand how to fix the message
This integration ensures that all AI-generated commit messages follow your team's established commit conventions without requiring manual corrections.
MIT