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.4.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.4.0
File Size Uploaded
git2svn-0.4.0.tar.gz 34.4 kB Details

Built distribution (wheel)

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

Total release size: 61.4 kB

Release files / git2svn-0.4.0.tar.gz

Download URL git2svn-0.4.0.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0f71d0e293a2276ecf7a27a2636e931120f6b35650f16e508b3e245dd9e350f7
BLAKE2b-256 checksum
How to use checksums
03d1349c3d7c7a61c203e6349ef19fb79a9eedbcd0e85db2b1e20bd17fe42465
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 Sep 30, 2026.

Transparency log

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

Download URL git2svn-0.4.0-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dc7a058ea51bb2c195283be18408875948879b70efba16acb3ce8be532080fc
BLAKE2b-256 checksum
How to use checksums
f438d431829f91f519dfc204a0549c69242b7442cc91c7554a4ab3b39549a36c
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 Sep 30, 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