Skip to content

ApertaCodex/aicommit

Repository files navigation

aicommit

Generate conventional commit messages using AI.

Installation

Quick Install (Recommended)

curl -fsSL https://devshub.ai/aicommit/install.sh | bash

Or via GitHub:

curl -fsSL https://raw.githubusercontent.com/apertacodex/aicommit/main/install.sh | bash

Homebrew (macOS/Linux)

brew tap apertacodex/aicommit
brew install aicommit

Debian/Ubuntu

# Download latest release
wget https://github.com/ApertaCodex/aicommit/releases/latest/download/aicommit_VERSION_all.deb
sudo dpkg -i aicommit_VERSION_all.deb
sudo apt-get install -f  # Install dependencies

Fedora/RHEL/CentOS

sudo yum install https://github.com/ApertaCodex/aicommit/releases/latest/download/aicommit-VERSION-1.noarch.rpm

From Source

git clone https://github.com/ApertaCodex/aicommit.git
cd aicommit
./install.sh

Setup

Set your OpenAI API key:

export OPENAI_API_KEY='your-api-key-here'
echo 'export OPENAI_API_KEY="your-api-key-here"' >> ~/.bashrc

Install jq:

# Ubuntu/Debian
sudo apt-get install jq

# macOS
brew install jq

Usage

aicommit                    # Commit and push (default)
aicommit -n / --no-push     # Commit without pushing
aicommit -y / --yes         # Auto-accept generated message
aicommit -c / --changelog   # Update CHANGELOG.md with commit
aicommit -p groq            # Select provider for this run
aicommit -p openai -m gpt-4o-mini   # Override provider model
aicommit -y -n              # Combine options
aicommit -c -y -n           # All options together

# Also works as a git command
git aicommit

The tool analyzes your git changes, generates a conventional commit message, and lets you review, edit, or abort before committing.

CHANGELOG Integration

The --changelog (or -c) flag automatically updates CHANGELOG.md following the Keep a Changelog format.

How it works

  1. After committing your changes, the tool parses the commit message
  2. Extracts the conventional commit type and description
  3. Updates CHANGELOG.md with an entry in the "Unreleased" section
  4. Amends the commit to include the changelog update

Commit Type Mapping

Commit Type Changelog Section
feat Added
fix Fixed
docs, refactor, test, chore, style Changed

Entry Format

Each entry includes the commit description and short hash:

- Add new user authentication feature (abc1234)

Example

# Make some changes
echo "new feature" > feature.txt

# Commit with changelog update
aicommit --changelog

# Your CHANGELOG.md will automatically include:
# ## [Unreleased]
#
# ### Added
# - Add new user authentication feature (abc1234)

Notes

  • If CHANGELOG.md doesn't exist, it will be created with the standard template
  • If CHANGELOG.md has uncommitted changes, the update is skipped (commit still succeeds)
  • The changelog entry is added to the same commit (using git commit --amend)

Development

Running Tests

# Install BATS (Bash Automated Testing System)
git clone https://github.com/bats-core/bats-core.git
cd bats-core && sudo ./install.sh /usr/local

# Run tests
cd /path/to/aicommit
./tests/run-tests.sh

Linting

shellcheck aicommit install.sh scripts/*.sh

Contributing

See CONTRIBUTING.md for development guidelines and contribution process.

CI/CD

This project uses GitHub Actions for:

  • Automated testing on every PR (shellcheck, integration tests, install validation)
  • Automated releases on version tags
  • Multi-platform package building (deb, rpm)
  • Homebrew formula updates

See .github/workflows/ for workflow details.

License

MIT

Built with ❤️ by Moussa Mokhtari

About

AI-powered git commit message generator

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages