Skip to content

rm-hull/git-commit-summary

Repository files navigation

Git Commit Summary

Tired of writing git commit messages? This tool uses AI ✨ to automatically generate a concise commit summary for your staged changes.

Features

  • Automatic Commit Summaries: Analyzes your staged changes and generates AI-slop high-quality commit messages.
  • Interactive Confirmation: Prompts you to confirm the commit message before committing.
  • Colorful Output: Provides a visually appealing and easy-to-read output in your terminal.

Installation

go install github.com/rm-hull/git-commit-summary

Installation

Set up your API key

git-commit-summary is XDG compliant, meaning it looks for its configuration file in a standard location. Create a config.env file in your XDG config home directory, e.g. on:

  • Linux: ~/.config/git-commit-summary/config.env,
  • MacOS: ~/Library/Application Support/git-config-summary/config.env, or
  • Windows: %USERPROFILE%\.config\git-commit-summary\config.env.

You can configure the LLM provider by setting the LLM_PROVIDER environment variable. The supported providers are google (default) and openai.

For local development or repository-specific overrides, you can still create a .env file in your git repository root.

For more information on the XDG Base Directory Specification, see: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Google

Add your Gemini API key to the config.env file:

GEMINI_API_KEY=<your_api_key>

Get an API key from: https://aistudio.google.com/api-keys

You can also optionally set the GEMINI_MODEL environment variable to specify which model to use. The default is gemini-2.5-flash-preview-09-2025.

OpenAI

Add your OpenAI API key to the config.env file:

OPENAI_API_KEY=<your_api_key>

You can also optionally set the OPENAI_MODEL environment variable to specify which model to se. Note, if no model is selected, gpt-4o is used as the default.

Additionally, you can also set OPENAI_BASE_URL - this is especially useful if you want to point to a local llama.cpp service. For example, you may use the following config:

LLM_PROVIDER="openai"
OPENAI_BASE_URL="http://localhost:8080/v1"
OPENAI_MODEL="Meta-Llama-3.1-8B-Instruct-Q4_K_M"

Usage

Once installed, check that the executable is on the $PATH, with git-commit-summary --version. Then, as part of your development workflow

  1. Stage your changes:

    git add <files>
  2. Run the tool:

    git commit-summary
  3. Confirm the commit:

    The tool will display the generated commit summary and ask for your confirmation. Note that it is possible to amend the message, if necessary. Type CTRL-X to accept and commit, or ESC to abort.

    $ git commit-summary
    ╭ Commit message ──────────────────────────────────────────────────────────╮
    │ docs: Clarify config paths and update usage keys                         │
    │                                                                          │
    │ Clarify the README by addressing several points:                         │
    │                                                                          │
    │ *   Configuration path examples are now bulleted and                     │
    │     bolded by OS for better clarity in the Installation                  │
    │     section.                                                             │
    │ *   The commit confirmation keys in the Usage section                    │
    │     are updated from `y/n` to `CTRL-X`/`ESC` to reflect                  │
    │     the current keybindings.                                             │
    │ *   Added a detailed usage example block.                                │
    ╰──────────────────────────────────────────────────────────────────────────╯
    (Ctrl-X to commit, ESC to abort)
    

Flags

Flag Shorthand Description
--version -v Display version information
--message -m Append a message to the commit summary
--llm-provider n/a Use the specific LLM provider: supported values are currently only google & openai. Overrides the LLM_PROVIDER environmental variable.

Aliases

If you want to use a shorter command, you can add an alias to your ~/.gitconfig file. For example, to use git cs as a shorthand for git commit-summary, you can run the following command:

git config --global alias.cs commit-summary

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Automatically generates a concise commit summary for your staged changes

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages