Skip to content

caiquearaujo/gitmit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

53 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gitmit

Python Version Software License UV

Gitmit Preview

Gitmit is a powerful Git repository manager that helps you maintain clean and consistent commit messages using AI-powered commit message generation. It follows GitFlow requirements and provides a standardized way to manage your Git repositories.

Features

  • πŸ€– AI-powered commit message generation using Google's Gemini or Ollama;
  • πŸ“ Standardized commit message format with emojis and types;
  • πŸ”„ Automatic branch management following GitFlow;
  • πŸ“Š Token usage tracking for AI services;
  • πŸ“ (optional) Summarize changes in the current branch to not share the entire commit history with external AI models;
  • πŸ”§ Easy configuration and setup.

Details

Summarization

The summarization feature is optional and can be enabled by setting the models.resume model in the configuration file.

The main goal for this feature is to not share the entire commit history with external AI models, but only the summarized changes in the current branch.

You should have ollama installed to use this feature.

When the models.commit is set to ollama/..., the summarization will be ignored.

Token Usage

The token usage is tracked in a MySQL database. It will be started automatically, so it's a must set configuration.

The main goal for this feature is keeping track the token usage across different devices. You choose a database, and anytime you use the tool, the token usage will be updated and synced accordingly.

Installation

From Release

  1. Download the latest release file from the GitHub releases page;

  2. Move the downloaded file to /usr/local/bin/gitmit or any other directory you want;

  3. Make the file executable:

    # You may need to use sudo to make the file executable
    chmod +x /usr/local/bin/gitmit

When you set another bin directory, you need to update the PATH environment variable to include the new directory.

From Source

This project uses UV as the package manager.

  1. Clone the repository:

    git clone https://github.com/caiquearaujo/gitmit.git
    cd gitmit
  2. Install UV (if not already installed):

    # On macOS and Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # On Windows
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  3. Install dependencies and set up the environment:

    uv sync
  4. Build the executable:

    uv run python build.py
  5. Move the file to /usr/local/bin/gitmit or any other directory you want:

    # You may need to use sudo to move the file to the bin directory
    mv /tmp/gitmit/gitmit-x.x.x.pex /usr/local/bin/gitmit
  6. Make the file executable:

    # You may need to use sudo to make the file executable
    chmod +x /usr/local/bin/gitmit

When you set another bin directory, you need to update the PATH environment variable to include the new directory.

Development

After setting up with UV, you can run the project in development mode:

# Run gitmit directly
uv run gitmit [command]

# Or activate the virtual environment
source .venv/bin/activate
gitmit [command]

To add new dependencies:

# Add a runtime dependency
uv add <package>

# Add a development dependency
uv add --group dev <package>

Configuration

  1. Run the config command to generate the configuration file:

    gitmit config
  2. The configuration file will be created at ~/.config/gitmit/config.ini. Edit it with your preferred text editor.

The configuration file will be written with 600 permissions, so it will be readable only by the current user.

Configuration Options

Models Section

[models]
# Required: The model to use for commit message generation
# Format: service/model (e.g., google/gemini-2.0-flash or ollama/codellama)
commit = google/gemini-2.0-flash

# Optional: The model to use for change summarization
# Leave empty to disable
resume = ollama/codellama

The available LLM services are: google and ollama. You can use any model supported by services, make sure to use the correct model name.

Google Section

[google]
# Required if using Google models: Your Google API key
api_key = your-api-key-here

Ollama Section

[ollama]
# Required if using Ollama models: The Ollama server URL
host = http://localhost:11434

MySQL Section

[mysql]
# Required: Database connection settings for token usage tracking
host = localhost
port = 3306
user = root
password = your-password
database = gitmit

Usage

Initialize a Repository

It will be used to initialize a new repository.

gitmit init [options]

Options:

  • --dev: Create a dev branch (GitFlow);
  • --origin: Set the origin URL for the remote repository.

Example:

gitmit init --dev --origin https://github.com/username/repo.git

Commit Changes

It will be used to commit the changes to the current branch.

gitmit commit [options]

Options:

  • --push: Automatically push changes to the remote repository;
  • --force: Skip confirmation before committing;
  • -m, --mode: Set the mode of the commit. Available options: manual or ai;
  • -b, --brief: Type a brief summary of the changes.

Example:

gitmit commit --push

When committing, you'll be presented with two options:

  1. πŸ€– Generated: AI will analyze your changes and generate an appropriate commit message;
  2. πŸ₯΅ Manual: You can manually create a commit message following the standardized format.

Update

It will be used to update the tool to the latest version. Only supported to the official repository.

gitmit update

Example:

gitmit update

Commit Types

Gitmit supports various commit types with corresponding emojis:

Emoji Type Description
✨ feat New features
🩹 fix General fixes
🐞 bug Bug fixes
πŸ“š docs Documentation changes
πŸ’Ž style Code style changes
πŸ“¦ refactor Code refactoring
🐎 perf Performance improvements
♻️ improvement General improvements
βœ… test Test changes
🚨 lint Linter fixes
πŸ”§ build Build changes
βš™οΈ ci CI changes
♻️ chore Maintenance tasks
βͺ revert Reverting changes
⏫ dependencies Dependency updates
πŸ“‡ metadata Metadata changes
πŸ”– version Version updates
πŸ”’ security Security fixes
πŸš‘ critical Critical changes
πŸ‘Œ review Code review changes
🧱 other Other changes

Upgrades & Integrations

Follow the Release Notes to keep your project up-to-date.

Community & Contributions

The community and core team are available in GitHub Discussions, where you can ask for support, discuss roadmap, and share ideas.

Our Contribution Guide describes how to contribute to the codebase and docs.

Credits

License

MIT. See LICENSE.

About

A python tool to handling commits in a better way by using LLMs.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages