Skip to content

ktappdev/gitcomm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitComm

GitComm is a CLI tool that uses LLMs (Gemini by default) to automatically generate meaningful Git commit messages by analyzing your staged changes.

Features

  • 🤖 Uses AI to analyze staged changes and generate commit messages
  • ⚡ Powered by Google's Gemini (with Groq and OpenAI fallback support)
  • 🚀 Auto-commit and push capabilities
  • 💻 Cross-platform support (Windows, macOS, Linux)

Installation

Using Go Install

go install github.com/ktappdev/gitcomm@latest

From Releases

Download the appropriate binary for your system from the releases page.

Building from Source

# Clone the repository
git clone https://github.com/ktappdev/gitcomm.git

# Enter the directory
cd gitcomm

# Build
go build

# Or use the build script for all platforms
./build.sh

Setup

You have two options to configure your API keys:

  1. Interactive Setup (Recommended):

    gitcomm -setup

    This will guide you through setting up your API keys.

  2. Environment Variables:

    # For Gemini (default)
    export GEMINI_API_KEY=your_gemini_api_key
    
    # For Groq (optional fallback)
    export GROQ_API_KEY=your_groq_api_key
    
    # For OpenAI (optional fallback)
    export OPENAI_API_KEY=your_openai_api_key

API keys are stored securely in ~/.gitcomm/config.json. Environment variables will override stored configuration.

Usage

  1. Stage your changes as normal:
git add .
  1. Generate a commit message:
gitcomm
  1. Auto-commit with the generated message:
gitcomm -auto
  1. Auto-commit and push:
gitcomm -ap

Examples

# Basic usage - will analyze changes and suggest a commit message
gitcomm

# Stage all changes and generate a commit message
gitcomm -sa

# Stage all changes, generate message, and auto-commit
gitcomm -sa -auto

# Stage all changes, generate message, auto-commit, and push
gitcomm -sa -ap

Configuration

GitComm uses the following defaults:

  • LLM Provider: Gemini
  • Model: gemini-1.5-flash-8b
  • Max Tokens: 50 (approximately 2 lines of text)
  • Temperature: 0.7 (balanced between creativity and consistency)

Environment Variables

  • GEMINI_API_KEY: Your Gemini API key (required by default)
  • GROQ_API_KEY: Your Groq API key (optional, for fallback)
  • OPENAI_API_KEY: Your OpenAI API key (optional, for fallback)

Command Line Flags

  • -auto: Automatically commit with the generated message
  • -ap: Automatically commit and push to remote
  • -sa: Stage all changes before analyzing (equivalent to git add .)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details

Acknowledgments

  • Google for their fast LLM API
  • The Go community for the excellent tooling

Troubleshooting

Common Issues

  1. No API Key Set

    Error: API key not set for provider gemini
    

    Solution: Set your GEMINI_API_KEY environment variable

  2. No Staged Changes

    No staged changes. Please stage your changes before running gitcomm.
    

    Solution: Stage your changes using git add

  3. Push Failed

    Error pushing changes
    

    Solution: Check your remote repository configuration and permissions

Getting Help

If you encounter any issues:

  1. Check the troubleshooting section above
  2. Search existing GitHub issues
  3. Create a new issue with:
    • Your OS and version
    • Command used
    • Full error message
    • Steps to reproduce

About

automate git commits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages