GIM 2.0: Personalize and Optimize AI-Generated Git Commit Messages

We are excited to announce the official release of **GIM (Git Intelligence Message) 2.0**!

GIM is a **command-line tool designed to automatically generate high-quality Git commit messages based on code changes**. It leverages AI to help you write more standardized, semantic, and readable commit messages. Version 2.0 represents a significant **core capability upgrade** from the 1.x series, specifically addressing the common pain points of customization and consistency encountered when using AI-generated commits in real-world projects.

Official Website: https://git-intelligence-message.pages.dev/

Repository: https://github.com/davelet/git-intelligence-message

Key New Features in GIM 2.0

1. Local Project Prompt Support (.gim Directory)

Version 2.0 introduces the ability to create a .gim folder in the root directory of your Git repository. This folder can store **project-specific prompt templates**:


your-project/
├── .git/
├── .gim/
│   ├── diff_prompt.txt
│   └── subject_prompt.txt

This enables:

  • Each project to define its own AI prompt templates.
  • Different projects to maintain their configurations independently, without sharing or modifying global settings.
  • Team conventions and commit styles to be documented directly within the repository, ensuring **natural consistency among team members**.

2. Command-Line Temporary Prompt Overrides

Previous versions required prompt templates to be managed through global configuration files, lacking flexibility. Version 2.0 introduces command-line arguments for temporary overrides:

--diff-prompt <STRING>
--subject-prompt <STRING>

For example:

gim --diff-prompt "Analyze security implications of changes" \
    --subject-prompt "Generate commit title in a standardized format"

This allows you to **temporarily override AI guidance for a specific commit**, which is ideal for:

  • Temporarily crafting "security-related commits".
  • Commits requiring a special format.
  • Experimenting with new prompting strategies.

Prompt Precedence

  1. Command Line (Highest)
  2. Project-specific .gim directory
  3. Global Configuration
  4. Built-in Defaults

Standardizing Commit Conventions Per Project

In your project's root directory:

mkdir .gim
echo "Highlight security impacts when analyzing changes" > .gim/diff_prompt.txt
echo "Generate commit titles in a standardized format" > .gim/subject_prompt.txt

All team members will automatically adhere to these conventions without individual configuration.

Temporarily Overriding Prompts

gim --diff-prompt "Focus on performance improvements" \
    --subject-prompt "Performance optimization commit"

Recommended Usage Patterns

  • gim: Generates a commit message based on staged file changes and commits.
  • gim -a: Stages all unstaged changes, then generates and commits the message.
  • gim -p: Amends the previous commit by incorporating the currently staged changes and regenerating the commit message based on both sets of changes.
  • gim -ap: Combines the functionality of gim -a followed by gim -p (stage all, then amend commit).
  • gim -t <SUB>: Specifies the commit title. If the -t option is not provided, the title is automatically summarized from the message content.
  • gim update: Updates the GIM software. This can also be done via brew upgrade git-intelligence-message.
  • gim ai -m <model> -k <apikey> -u <url> -l <language>: Configures AI parameters. This command must be run beforehand; otherwise, executions with parameters will fail. -l defaults to English and can be omitted. -u is the API endpoint. The software includes built-in endpoints; see https://github.com/davelet/git-intelligence-message?tab=readme-ov-file#built-in-model-support for details. If a model name matches a prefix, you can omit the URL. Starting from version 1.3.2, running gim ai without arguments will display the current configuration.
  • gim -v: Any command can include the -v flag for verbose output, showing detailed execution steps.
  • gim prompt: View current prompts. Use --edit to modify prompts, or --prompt <P> to specify the file to edit.

For more detailed usage information, consult the help messages:

  • gim -h
  • gim ai -h
  • gim update -h
  • gim prompt -h

Tags: Git AI commit message CLI automation

Publicado em 7-28 17:12