Git-to-SVN Synchronization CLI (git2svn)
A lightweight, zero-dependency Python 3 CLI utility to bridge local Git development workspaces with a Subversion (SVN) repository. It provides two symmetrical, intuitive commands to either stage changes for manual review (stage) or sequentially commit them into SVN history (replay).
What git2svn Is (and What It Is Not)
✅ What git2svn is designed for:
- Complementing an existing
svn2gitmirror: You have an automated or incremental SVN-to-Git mirror (e.g. viaall-fast-export,subgit, or an internal sync job) pulling SVN revisions into a tracking branch (such asorigin/svn-mirror/trunkormirror/trunk).git2svnserves as the reverse gateway, letting you replay your local feature branches cleanly back into SVN. - Local Git freedom with an SVN backend: Work locally with Git branches, stashes, and interactive rebases, then ship clean changesets to SVN with zero manual copy-pasting.
- Safe, staged inspection (
stage): Reviewing complex diffs or running pre-commit checks in TortoiseSVN before changes touch the SVN server. - Sequential commit porting (
replay): Porting multi-commit PRs into SVN with original commit messages and conflict pause-and-resume control.
❌ What git2svn is NOT designed for:
- It is NOT an autonomous full-mirror / bidirectional replication tool:
git2svndoes not automatically track arbitrary Git tags, merge trees, or multi-branch mappings across repositories. Git history should be strictly linear before replaying to SVN. - It is NOT intended for Git-as-master workflows: If Git is your authoritative source of truth and you merely want to mirror everything into a passive SVN replica without human interaction, use a dedicated continuous migration daemon like SubGit.
Key Highlights
- Zero External Dependencies: Built purely on Python 3 standard library and standard
git/svnCLI tools. - Smart CRLF/LF Normalization: Automatically reconciles line endings post-patch, preventing Subversion
E135000: Inconsistent line ending stylecommit 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
Workflow & Basic Commands
git2svn is designed so you bootstrap once with setup, after which all synchronization commands run cleanly without needing --svn-dir or --svn-url:
# 1. Bootstrap once in your Git repository (URL or local path)
# This automatically checks out a managed SVN copy into .git/git2svn/svn_wc,
# detects mirror tracking branches, installs a pre-push guard against accidental pushes,
# and configures convenient git aliases.
git2svn setup https://svn.example.com/repo/trunk
# (or with an existing local checkout: git2svn setup /path/to/svn)
# 2. Check synchronization health and pending commits
git2svn status
# 3. Stage a single commit or squash an entire branch (uncommitted for review)
git2svn stage a1b2c3d4
git2svn stage main..feature/login --diff
# 4. Preview uncommitted staged changes in SVN
git2svn diff
git2svn diff --stat
# 5. Replay an entire feature branch commit-by-commit into SVN history
git2svn replay main..feature/login
# 6. Resume replay after resolving conflicts
git2svn replay --continue
# 7. Discard staged changes, remove conflict artifacts, or purge managed workspace
git2svn clean
git2svn clean --purge
# 8. Or use the built-in Git aliases created during setup:
git svn-push # Replay trunk commits to SVN and fetch mirror
git svn-pull # Pull fresh SVN mirror commits & rebase local trunk
git svn-status # Run git2svn status
(Note: Advanced users or CI/CD scripts can still pass --svn-dir <path> or --svn-url <url> to override the configured workspace on any command).
Architecture at a Glance
flowchart LR
subgraph Local["Developer Workstation"]
direction LR
Git[("Git Workspace<br/>(feature branch)")]
Tool["git2svn Engine<br/>• Diff & Patch<br/>• EOL Normalizer<br/>• Conflict Recovery"]
SVN[("SVN Working Copy<br/>(trunk / branch)")]
end
Remote[("Remote SVN Server<br/>(Central Repository)")]
Git -->|"Reads commits & diffs"| Tool
Tool -->|"stage: patch & stage (uncommitted)"| SVN
Tool -->|"replay: patch & commit each revision"| SVN
SVN -->|"Manual commit (after stage review)"| Remote
SVN -->|"Atomic svn commit (during replay)"| Remote
Documentation
Comprehensive documentation-as-code is maintained in the docs/ folder:
- User Guide: Complete CLI options, command reference, the Git Integration Branch Workflow, and troubleshooting FAQ.
- Architecture Documentation: Architectural design, package building blocks, runtime sequence diagrams, cross-cutting concepts, and Architecture Decision Records (ADRs).
- Requirements Specification: Detailed stakeholders, functional requirements, and quality goals.
- Contributing Guidelines: Development setup, coding conventions, Conventional Commits, and test instructions.
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.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| git2svn-0.10.0.tar.gz | 81.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git2svn-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.3 kB
Release files / git2svn-0.10.0.tar.gz
| Download URL | git2svn-0.10.0.tar.gz |
|---|---|
| Size | 81.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4068f2884eb5fabfdfcd93fa3bb86f9beba53ea1f69d2a3f36b73127f319a29
|
|
BLAKE2b-256 checksum How to use checksums |
fa764639b9eea571158a4392523f2e381ee9e437b2f7d42e1ba7288c2b4cea1c
|
| 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 logRelease files / git2svn-0.10.0-py3-none-any.whl
| Download URL | git2svn-0.10.0-py3-none-any.whl |
|---|---|
| Size | 39.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71e89d5be05cc401648dcbeb517a57ed7173d04233eef25628b44e7cdbd3a965
|
|
BLAKE2b-256 checksum How to use checksums |
f7feb446512dd626026e7db9cd9d4727129aa175b3059e254cb813c911930e7a
|
| 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