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.5.2

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.5.2
File Size Uploaded
git2svn-0.5.2.tar.gz 62.0 kB Details

Built distribution (wheel)

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

Total release size: 92.6 kB

Release files / git2svn-0.5.2.tar.gz

Download URL git2svn-0.5.2.tar.gz
Size 62.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4dfbc08b14808662098a6a5dc7b9bc98b31aeed43159b4d86b9a8fdafbc1a59b
BLAKE2b-256 checksum
How to use checksums
1c1e2182a321a8d07e85268c33300dd286828ab1638d5243ef0bed7e1c1d02d4
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.5.2-py3-none-any.whl

Download URL git2svn-0.5.2-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19abaf19694580987287700fe974633c95b2703ff264ec2f49b691b7e9a53822
BLAKE2b-256 checksum
How to use checksums
de3b51de83053bd7502e57c62d82ce965b558fa948d24fbdea536e24e820313b
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