commit-msg

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2025 License: MIT

README ΒΆ

commit-msg

Hacktoberfest Go Version License

commit-msg is a command-line tool that generates commit messages using LLM (Large Language Models). It is designed to help developers create clear and concise commit messages for their Git repositories automatically by analyzing your staged changes.

Screenshot

Below is a sample execution of commit-msg:

Commit-msg Screenshot

Before running the application, ensure you have set the system environment variables. and add commit.exe to path variables (same for linux macOS)

πŸŽƒ Hacktoberfest 2025

This project is participating in Hacktoberfest 2025! We welcome contributions from developers of all skill levels.

Looking to contribute? Check out:

Features

✨ AI-Powered Commit Messages - Automatically generate meaningful commit messages
πŸ”„ Multiple LLM Support - Choose between Google Gemini or Grok
πŸ“ Context-Aware - Analyzes staged and unstaged changes
πŸš€ Easy to Use - Simple CLI interface
⚑ Fast - Quick generation of commit messages

Supported LLM Providers

You can use either Google Gemini or Grok as the LLM to generate commit messages:

Environment Variables
Variable Values Description
COMMIT_LLM gemini or grok Choose your LLM provider
GEMINI_API_KEY Your API key Required if using Gemini
GROK_API_KEY Your API key Required if using Grok

πŸ“¦ Installation

  1. Download the latest release from the GitHub Releases page

  2. Extract the executable to a directory

  3. Add the directory to your system PATH:

    Windows:

    setx PATH "%PATH%;C:\path\to\commit-msg"
    

    Linux/macOS:

    export PATH=$PATH:/path/to/commit-msg
    echo 'export PATH=$PATH:/path/to/commit-msg' >> ~/.bashrc  # or ~/.zshrc
    
  4. Set up environment variables:

    Windows:

    setx COMMIT_LLM "gemini"
    setx GEMINI_API_KEY "your-api-key-here"
    

    Linux/macOS:

    export COMMIT_LLM=gemini
    export GEMINI_API_KEY=your-api-key-here
    # Add to ~/.bashrc or ~/.zshrc to persist
    
Option 2: Build from Source

Requirements: Go 1.23.4 or higher

# Clone the repository
git clone https://github.com/dfanso/commit-msg.git
cd commit-msg

# Install dependencies
go mod download

# Build the executable
go build -o commit src/main.go

# (Optional) Install to GOPATH
go install

πŸš€ Usage

Basic Usage

Navigate to any Git repository and run:

commit .

Or if running from source:

go run src/main.go .
Example Workflow
# Make changes to your code
echo "console.log('Hello World')" > app.js

# Stage your changes
git add .

# Generate commit message
commit .

# Output: "feat: add hello world console log to app.js"
Use Cases
  • πŸ“ Generate commit messages for staged changes
  • πŸ” Analyze both staged and unstaged changes
  • πŸ“Š Get context from recent commits
  • βœ… Create conventional commit messages

πŸ”§ Configuration

Getting API Keys

Google Gemini:

  1. Visit Google AI Studio
  2. Create a new API key
  3. Set the GEMINI_API_KEY environment variable

Grok (X.AI):

  1. Visit X.AI Console
  2. Generate an API key
  3. Set the GROK_API_KEY environment variable

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Quick Start for Contributors
  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Commit your changes: git commit -m 'feat: add amazing feature'
  5. Push to the branch: git push origin feature/amazing-feature
  6. Open a Pull Request
Areas Where We Need Help
  • πŸ› Bug fixes
  • ✨ New LLM provider integrations (OpenAI, Claude, etc.)
  • πŸ“š Documentation improvements
  • πŸ§ͺ Test coverage
  • 🌍 Internationalization
  • ⚑ Performance optimizations

πŸ“„ License

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


πŸ™ Acknowledgments

  • Thanks to all contributors
  • Google Gemini and X.AI Grok for providing LLM APIs
  • The open-source community

πŸ“ž Support


Made with ❀️ for Hacktoberfest 2025

Directories ΒΆ

Path Synopsis
src

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL