Skip to main content

git-translate-commits

PyPI Python License: GPL v3 Tests

Translate git commit messages to a target language. Runs 100% offline by default using Argos Translate -- no API key, no cost. Optionally use LLM APIs for higher-quality contextual translation.

Why?

With LLM-powered coding assistants generating commits in mixed languages, repositories end up with inconsistent commit histories. This tool normalizes all commit messages to your preferred language in a single command.

Installation

The recommended way to install CLI tools is with pipx (isolated environment) or uv:

# Recommended: pipx (isolated install)
pipx install git-translate-commits

# Or: uv
uv tool install git-translate-commits

# Or: plain pip
pip install git-translate-commits

For LLM-based translation (optional):

pipx install "git-translate-commits[llm]"
# or: pip install "git-translate-commits[llm]"

For best rewrite performance, also install git-filter-repo:

pip install git-filter-repo

Quick Start

# Preview changes (offline, no API key needed)
git-translate-commits --lang en --dry-run

# Translate all commits on current branch to English (offline)
git-translate-commits --lang en

# Translate all branches to Brazilian Portuguese
git-translate-commits --lang pt-BR --all-branches

# Use LLM for higher quality (requires API key)
export OPENAI_API_KEY="sk-..."
git-translate-commits --lang en --engine llm

Translation Engines

Local (default) -- --engine local

Uses Argos Translate, an offline neural machine translation engine based on OpenNMT. Language packs (~50MB each) are downloaded automatically on first use.

  • No API key required
  • No cost
  • Fully offline after first download
  • Good quality for common language pairs

LLM -- --engine llm

Uses LLM APIs (OpenAI, Anthropic, or any OpenAI-compatible provider) for contextual translation via litellm. Requires pip install "git-translate-commits[llm]".

  • Higher quality contextual translations
  • Batch processing to minimize API calls and cost
  • A 1,000-commit repo costs ~$0.05 with gpt-4o-mini

Usage

git-translate-commits [OPTIONS]

Required

Option Description
--lang, -l Target language code (en, pt-BR, es, fr, de, ja, ...)

Engine

Option Default Description
--engine, -e local Translation engine: local (offline) or llm (API-based)

Filtering

Option Description
--all-branches Process all local branches
--branch, -b Specific branch(es) to process (repeatable)
--author Filter commits by author email
--since Only commits after this date
--until Only commits before this date

LLM Configuration (only with --engine llm)

Option Default Description
--provider, -p openai LLM provider (openai, anthropic, openai-compatible)
--model, -m gpt-4o-mini Model to use
--api-key env var API key (prefer OPENAI_API_KEY / ANTHROPIC_API_KEY env vars)
--api-base-url — Base URL for OpenAI-compatible providers
--batch-size 20 Messages per LLM request

Behavior

Option Default Description
--dry-run, -n false Preview changes without modifying anything
--skip-already-translated true Skip messages already in target language
--backup true Create backup branch before rewriting
--preserve-conventional true Preserve Conventional Commit prefixes
--force, -f false Skip confirmation prompt
--verbose, -v false Show detailed logs

Environment Variables

# Engine and language
export GIT_TRANSLATE_ENGINE="local"   # or "llm"
export GIT_TRANSLATE_LANG="en"

# LLM-only settings
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GIT_TRANSLATE_PROVIDER="openai"
export GIT_TRANSLATE_MODEL="gpt-4o-mini"

Examples

# Offline translation (default) — no API key needed
git-translate-commits --lang en

# Translate commits by a specific author
git-translate-commits --lang en --author "dev@example.com"

# Translate commits from the last year
git-translate-commits --lang en --since "2025-01-01"

# Use LLM engine for better contextual quality
git-translate-commits --lang en --engine llm

# Use Anthropic Claude via LLM engine
git-translate-commits --lang en --engine llm --provider anthropic --model claude-sonnet-4-20250514

# Use a local OpenAI-compatible server (e.g. Ollama) via LLM engine
git-translate-commits --lang en --engine llm \
  --provider openai-compatible \
  --api-base-url http://localhost:11434/v1 \
  --model llama3

# Skip confirmation and backup
git-translate-commits --lang en --force --no-backup

What Gets Preserved

  • File contents — no code is touched
  • Author/committer — name, email, timestamps
  • Conventional Commit prefixes — feat:, fix:, chore:, etc.
  • Issue references — #123, JIRA-456
  • Git trailers — Co-authored-by, Signed-off-by, etc.

⚠️ Important Notes

  • Commit hashes will change. This is unavoidable since the message is part of the SHA hash. Coordinate with your team before force-pushing.
  • A backup branch is created automatically before any changes (disable with --no-backup).
  • A log file (.git-translate-log.json) is written with the full mapping of changes.
  • Local engine is free. LLM engine costs ~$0.05 per 1,000 commits with gpt-4o-mini.

Contributing

Contributions are welcome! Please read the Contributing Guide for details on how to get started.

Development

git clone https://github.com/paladini/git-translate-commits.git
cd git-translate-commits
pip install -e ".[dev]"
pytest

See CONTRIBUTING.md for full development guidelines.

License

This project is licensed under the GNU General Public License v3.0 -- see the LICENSE file for details.

Author

Created and maintained by Fernando Paladini.

Metadata

Release files for git-translate-commits 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-translate-commits 1.0.1
File Size Uploaded
git_translate_commits-1.0.1.tar.gz 35.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-translate-commits 1.0.1
File Interpreter ABI Platform
git_translate_commits-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 72.0 kB

Release files / git_translate_commits-1.0.1.tar.gz

Download URL git_translate_commits-1.0.1.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
07cddeaaa6ce84ac9f586ae2225fe9c3c8a59ada29a425d9fb290bc64d2b83d0
BLAKE2b-256 checksum
How to use checksums
37973b38fdb1c16800afd6b07393aed5459a12aca60a9a9f262ac8e8c05007ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release files / git_translate_commits-1.0.1-py3-none-any.whl

Download URL git_translate_commits-1.0.1-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b707b94bf22fe15b556bc703588a69f4c4aa18cd9de5c262cad1a27352c25a5c
BLAKE2b-256 checksum
How to use checksums
99577f9c3207b9262eefc42c3e83bf2fb02d2fe4e02e4421880938cb421cda55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page