appleboy/CodeGPT
A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4.1, gpt-4o model) and automatically installs a git prepare-commit-msg hook.
What is CodeGPT?
CodeGPT is a command‑line tool (written in Go) that talks to large‑language‑model APIs (OpenAI, Azure OpenAI, Gemini, Anthropic, Ollama, Groq, OpenRouter) to help developers with two everyday Git tasks:
- Generate commit messages – it reads the
git diffof your staged changes, sends the diff to the chosen LLM, and returns a commit message that follows the Conventional Commits format. The tool can also install aprepare‑commit‑msgGit hook so the AI‑generated message is automatically inserted when you rungit commit. - Summarize code reviews – it can produce a short review of the changes in a pull‑request‑style summary.
Both features support streaming output (tokens appear as they are generated), language translation (English, Traditional‑Chinese, Simplified‑Chinese, Japanese), and custom prompt templates.
How do you get it?
- macOS –
brew tap appleboy/tap && brew install codegpt - Windows –
choco install codegpt - Any OS – run the provided install script or download a pre‑compiled binary from the GitHub releases page.
- From source –
go install github.com/appleboy/CodeGPT/cmd/codegpt@latest - VS Code devcontainer – add the
ghcr.io/kvokka/features/codegptfeature todevcontainer.json.
How does it work?
- Configuration – You supply an API key (or a command that fetches one dynamically) via an environment variable, a
.codegpt.yamlfile, or the built‑in API‑key helper feature. The config file lives under$HOME/.config/codegpt/and lets you set:- Provider (
openai,azure,gemini,anthropic,ollama,groq,openrouter) - Base URL, model name, temperature, max‑tokens, proxy settings, etc.
- Git‑specific options like how many context lines to include in the diff and which files to exclude.
- Provider (
- Running the CLI –
codegpt commit(orcodegpt review) reads the diff, builds a prompt from the selected template, calls the LLM endpoint, and prints the result. With the--streamflag you see the response token‑by‑token. - Git hook –
codegpt hook installwrites aprepare‑commit‑msgscript that invokes the CLI automatically, so everygit commitcan be auto‑filled with an AI‑generated message.
Who might find it useful?
- Developers who want consistent, conventional commit messages without manually writing them.
- Teams that need quick, readable summaries of code changes for pull‑request descriptions or internal reviews.
- Anyone who works with multiple LLM providers (e.g., prefers Azure OpenAI for compliance or wants to run locally with Ollama) – CodeGPT abstracts the provider behind a single CLI.
What are its limits?
- It is a client only; the quality of the generated text depends entirely on the underlying model you point it at.
- The tool needs internet access (or a local Ollama server) and a valid API key for the chosen provider.
- It does not perform any static analysis or linting – it merely forwards the diff to the model.
- The Git hook inserts the AI text verbatim; you should still review the message before finalising the commit.
Quick start example
# Install (macOS example)
brew tap appleboy/tap && brew install codegpt
# Export your OpenAI key (or configure it via `codegpt config set`)
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
# Generate a commit message for staged changes
codegpt commit
# Or install the hook so `git commit` does it automatically
codegpt hook install
Where to learn more?
- The repository’s README contains detailed installation steps, a full list of configuration options, and examples for each supported provider.
- Video walkthrough (Chinese) – https://www.youtube.com/watch?v=4Yei_t6eMZU
- Blog post explaining the idea – https://blog.wu-boy.com/2023/03/writes-git-commit-messages-using-chatgpt/
All information above is taken directly from the project's README; no additional features have been inferred.
Related
- Project
- Project
- Project
- Project
- Project