Skip to content

sidedwards/auto-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-commit

Automatically generate git commit messages using Claude 3 Haiku. Analyzes your staged changes and creates clear commit messages. Uses the conventional commit format by default, but you can also train it to use a repo or author-specific style.

output

Features

  • Generates clear, concise commit messages from staged changes
  • Supports multiple commit formats:
    • Conventional Commits (default)
    • Angular
    • Semantic Git Commits (with emojis)
    • Linux Kernel style
    • GitHub issue-reference style ([#123]: description)
    • Repository or author-specific commit styles
  • Simple CLI interface

Installation

Option 1: Quick Install (macOS/Linux)

curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash

This will:

  • Download the appropriate binary for your system
  • Add it to your PATH
  • Make it executable

Option 2: Manual Installation

  1. Download the latest release for your platform from GitHub Releases
  2. Move to a location in your PATH:
# macOS (M1/M2)
sudo mv auto-commit-darwin-arm64 /usr/local/bin/auto-commit

# macOS (Intel)
sudo mv auto-commit-darwin-x64 /usr/local/bin/auto-commit

# Linux
sudo mv auto-commit-linux-x64 /usr/local/bin/auto-commit

# Make executable (macOS/Linux)
sudo chmod +x /usr/local/bin/auto-commit

# Windows (PowerShell as Admin)
move auto-commit-windows-x64.exe C:\Windows\System32\auto-commit.exe

Option 3: Install from Source

# Install Deno
curl -fsSL https://deno.land/x/install/install.sh | sh

# Clone and install
git clone https://github.com/sidedwards/auto-commit.git
cd auto-commit
deno task install

Updating

# If installed with quick install or manual binary
curl -fsSL https://raw.githubusercontent.com/sidedwards/auto-commit/main/scripts/install.sh | bash

# If installed from source
cd auto-commit
deno task update

Usage

# Optional: Set up git alias
git config --global alias.ac '!auto-commit'

# Use the tool with default commit style (conventional)
git add <files>
auto-commit  # or 'git ac' if alias configured

# Use a specific commit format
auto-commit --format=conventional  # default
auto-commit --format=angular      # Angular style
auto-commit --format=semantic     # with emojis
auto-commit --format=kernel       # Linux kernel style
auto-commit --format=issue       # Issue reference style

# View repository authors
auto-commit --list-authors

# Learn commit style from repository history
auto-commit --learn

# Learn commit style from specific author
auto-commit --learn --author="user@example.com"

Example output:

Proposed commit:
┌────────────────────────────────────────────────────────────────────────┐
│ docs(README): update installation instructions                         │
│                                                                        │
│ - Add instructions for installing pre-built binary                     │
│   * Separate steps for macOS (M1/M2 and Intel), Linux, and Windows     │
│   * Move binary to PATH and make executable                            │
│ - Add instructions for installing from source                          │
│   * Install Deno                                                       │
│   * Clone repo and install with Deno task                              │
│ - Remove outdated development instructions                             │
└────────────────────────────────────────────────────────────────────────┘

(a)ccept, (e)dit, (r)eject, (n)ew message?

Configuration

On first run, you'll be prompted to enter your Anthropic API key.

Commit Formats

The tool supports multiple commit message formats:

  1. Conventional (default) - specification

    feat(auth): add OAuth2 authentication
    
    - Add login endpoints
    - Set up token management
    
  2. Angular - specification

    feat(auth): implement OAuth2 authentication
    
    * Add login endpoints
    * Set up token management
    
    BREAKING CHANGE: Remove basic auth support
    
  3. Semantic - includes emojis for visual clarity

    ✨ Add OAuth2 authentication
    
    - Add login endpoints
    - Set up token management
    
  4. Linux Kernel - style guide

    auth: implement secure token rotation
    
    Previous implementation had security flaws.
    This patch adds automatic rotation.
    
    Signed-off-by: John Doe <john@example.com>
    
  5. GitHub Issue-reference - specification

    [#123]: implement OAuth2 authentication
    
    - Add login endpoints
    - Set up token management
    
  6. Custom Styles

    # Learn from repository history
    auto-commit --learn
    
    # Learn from specific author
    auto-commit --learn --author="user@example.com"

    The tool can learn and adopt commit styles from your repository's history or a specific author's commits.

Override the format using --format:

auto-commit --format conventional  # default
auto-commit --format angular      # Angular style
auto-commit --format semantic     # with emojis
auto-commit --format kernel       # Linux style

Requirements

  • Git
  • GitHub CLI (gh) - for issue integration
  • Vim (for editing commit messages)
  • Anthropic API key

License

MIT