Skip to main content

Git-to-SVN Synchronization CLI (git2svn)

Build Status Coverage PyPI Version Python Version Lines of Code Latest Release License

A lightweight, zero-dependency Python 3 CLI utility to bridge local Git development workspaces with a Subversion (SVN) monorepo working copy. It provides two symmetrical, intuitive commands to either stage changes for manual review (stage) or sequentially commit them into SVN history (replay).


Key Highlights

  • Zero External Dependencies: Built purely on Python 3 standard library and standard git/svn CLI tools.
  • Smart CRLF/LF Normalization: Automatically reconciles line endings post-patch, preventing Subversion E135000: Inconsistent line ending style commit failures.
  • Clean Intent Model:
    • stage: Never commits. Staged in SVN (svn add, svn rm) for inspection in TortoiseSVN or CLI before manual commit.
    • replay: Always commits. Sequentially ports Git commits into SVN with original author messages and a stateful conflict recovery lifecycle.
  • Flexible Reference Syntax: Accepts single commits (abc1234), range notation (main..feature), or two positional arguments (main feature).
  • Binary & Snapshot Support: Direct object DB extraction (--copy) for binary assets and whole-tree alignment (--snapshot).

Quick Start

Installation

Install via pipx (recommended) or pip:

# Using pipx (isolated global CLI command):
pipx install git2svn

# Or via standard pip:
pip install git2svn

Alternatively, run directly from source without installing:

git clone https://github.com/simon123h/git2svn.git
cd git2svn
python3 -m git2svn --help

Basic Commands

# Optional: Set default SVN path in your Git repository so you don't need -s on every command
git config git2svn.svnDir /path/to/svn

# 1. Stage a single Git commit into SVN for review (uncommitted)
git2svn stage a1b2c3d4 -s /path/to/svn

# 2. Squash an entire feature branch into an uncommitted SVN changeset
git2svn stage main..feature/login

# 3. Replay an entire feature branch commit-by-commit into SVN history
git2svn replay main..feature/login

# 4. Resume an interrupted replay after resolving conflicts
git2svn replay --continue

Architecture at a Glance

flowchart TD
    Git[Git Workspace] -->|git diff / name-status| Bridge[git2svn CLI]
    Bridge -->|git apply or object extraction| SVN[SVN Working Copy]
    Bridge -->|Smart CRLF / LF normalization| SVN
    Bridge -->|svn add --parents / svn rm| SVN
    SVN -->|Review & Manual svn commit| Upstream[(SVN Server)]
    Bridge -.->|replay auto svn commit -F| Upstream

Documentation

Comprehensive documentation-as-code is maintained in the docs/ folder:


Development & Testing

# Run unit & integration tests
python3 -m unittest discover tests

# Lint and format with Ruff
ruff check --fix .
ruff format .

# Enable pre-commit hook
git config core.hooksPath .githooks
# or use pre-commit framework: pre-commit install

License

Distributed under the Apache-2.0 License.

Metadata

Release files for git2svn 0.7.0

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

Source distribution (sdist)

Source distribution for git2svn 0.7.0
File Size Uploaded
git2svn-0.7.0.tar.gz 67.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git2svn 0.7.0
File Interpreter ABI Platform
git2svn-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 101.7 kB

Release files / git2svn-0.7.0.tar.gz

Download URL git2svn-0.7.0.tar.gz
Size 67.5 kB
Tags Source
SHA-256 checksum
How to use checksums
50db6c6ca727dd361375077aa1f05d6a4e378c3b4c4d3a3de1ce765aa1802793
BLAKE2b-256 checksum
How to use checksums
e213743589b31d83eff56d5852f768e60ce2770d34e91c97c3369def4f73d0d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 1, 2026.

Transparency log

Release files / git2svn-0.7.0-py3-none-any.whl

Download URL git2svn-0.7.0-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2bca5403c48199e256066509a44b2dd7d57178648877a633901bc14cd5ac608
BLAKE2b-256 checksum
How to use checksums
f026d52d85b35cc58e2440fdb36c0ac34882cdb3d9868e288ad09cd8033b5a9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 1, 2026.

Transparency log
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