Skip to main content

CommitSync — autonomous CLI agent for context-aware git commit messages

Project description

CommitSync

Autonomous CLI agent that reads staged git changes and writes context-aware, convention-compliant commit messages using the Claude API.

PyPI package: commitsync · CLI commands: commitsync, gitcommit, git-commit, gc

Note: Do not run pip install gitcommit — that installs an unrelated, outdated PyPI package. Use commitsync or install from GitHub (below).

Quick start

pipx install commitsync
export ANTHROPIC_API_KEY="sk-ant-..."
cd my-repo
git add .
commitsync --dry-run
commitsync

Install

pipx (recommended)

Isolated install, works from any directory:

pipx install commitsync

From GitHub (latest main):

pipx install git+https://github.com/Debonik/git-commit-agent.git

From a local checkout:

pipx install .

pip

pip install commitsync

Or from GitHub:

pip install git+https://github.com/Debonik/git-commit-agent.git

From source

git clone https://github.com/Debonik/git-commit-agent.git
cd git-commit-agent
pip install .

Development

python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -e ".[dev]"

Commands

All entry points invoke the same CLI:

Command Notes
commitsync Primary command
gitcommit Legacy alias
git-commit Hyphenated alias
gc Short alias
python -m gitcommit Module invocation
commitsync --help
commitsync --dry-run
commitsync --yes

Run from inside any git repository with staged changes.

Shell examples

bash / zsh

export ANTHROPIC_API_KEY="sk-ant-..."
cd my-repo
git add .
commitsync

fish

set -x ANTHROPIC_API_KEY "sk-ant-..."
cd my-repo
git add .
commitsync

PowerShell

$env:ANTHROPIC_API_KEY = "sk-ant-..."
Set-Location my-repo
git add .
commitsync

cmd

set ANTHROPIC_API_KEY=sk-ant-...
cd my-repo
git add .
commitsync

Git alias

Add a commit-ai subcommand that delegates to CommitSync:

git config --global alias.commit-ai '!commitsync'

Usage:

git add .
git commit-ai

For git-commit or gc, point the alias at your preferred entry point:

git config --global alias.commit-ai '!git-commit'

Configuration

User config: ~/.config/gitcommit/config.toml

Optional repo config: .gitcommit.toml (overrides user settings)

Example ~/.config/gitcommit/config.toml:

model = "claude-sonnet-4-6"
recent_commits = 10
max_diff_tokens = 6000
convention = "auto"          # or "conventional"
include_ticket = true
exclude_patterns = [".env", "secrets/*", "*.pem"]

[cli]
extra_commands = ["git-commit", "gc"]

Environment variables

Variable Required Description
ANTHROPIC_API_KEY Yes Claude API key for message generation
EDITOR / VISUAL No External editor for [e]dit (falls back to nano/vi/vim/notepad, then stdin)

Flags

Flag Description
--dry-run Preview the message without committing
--yes / -y Auto-accept and commit
--model Override the configured model for this run
--no-body Generate subject line only
--verbose Print gathered context metadata and reasoning on stderr
--benchmark Print estimated token costs for typical diffs and exit

Split suggestions

When staged changes span clearly unrelated areas (for example auth code and documentation), CommitSync prints a split suggestion on stderr before proposing a message. Use git reset -p or partial staging to split the work into focused commits.

Regenerate variants

In the interactive prompt:

[a]ccept  [e]dit  [r]egenerate  [rc]oncise  [rd]etailed  [c]ancel
  • rc — regenerate a shorter message
  • rd — regenerate a more detailed message

Data privacy

  • What leaves your machine: staged diff metadata, recent commit subjects, branch name, and (when needed) small file snippets are sent to the Anthropic Claude API to generate a message.
  • What stays local: your API key is read from the environment or config and sent only to Anthropic over HTTPS; it is never printed by default.
  • Redaction: configure exclude_patterns to omit sensitive paths (e.g. .env, *.pem) from diffs and file reads before they reach the model.
  • Verbose mode: --verbose prints context metadata (branch, style, diff size) on stderr — never the full diff or API key.
  • No telemetry: CommitSync does not phone home or collect usage analytics.

Review Anthropic's data policies before use in regulated environments.

Interactive flow

When attached to a TTY, CommitSync prompts:

[a]ccept  [e]dit  [r]egenerate  [rc]oncise  [rd]etailed  [c]ancel
  • Accept — commit with the proposed message
  • Edit — open $EDITOR (or inline stdin fallback)
  • Regenerate — request a new message with the same context
  • Cancel — exit without committing (staged changes unchanged)

Use --yes in CI or scripts to skip the prompt.

Releasing (maintainers)

  1. Set PYPI_API_TOKEN in GitHub repository secrets (pypi.org).
  2. Bump version in pyproject.toml and merge to main.
  3. Tag and push:
git tag v0.1.0
git push origin v0.1.0

The release workflow builds the package, publishes commitsync to PyPI, and creates a GitHub Release.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commitsync-0.1.6.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commitsync-0.1.6-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file commitsync-0.1.6.tar.gz.

File metadata

  • Download URL: commitsync-0.1.6.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for commitsync-0.1.6.tar.gz
Algorithm Hash digest
SHA256 9b174830170b2cb961de0c916169b3f13ce30ffedb018e169b4d93ea3f6f6d22
MD5 6ebec7d3161c277dc99065980f5832ef
BLAKE2b-256 07ff911b0ceaffcb2786312bfca63f5a5ca39e4cc853b50dce65bdc57eaaa609

See more details on using hashes here.

File details

Details for the file commitsync-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: commitsync-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for commitsync-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5939cf205a7a60101d25a93985348ad31bba7ca3168bbcf5d8ab4338d0cf5b4e
MD5 09e6c902e85a915ead43a55b4ade349d
BLAKE2b-256 4221884c4fdd5441641e3414f4415ecb440116c66f8b36d0cb8869561e0a5c5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page