Fundamentals 5 min read

Migrating from SVN to Git: Concepts, Tools, and Self‑Service Design

This article explains the fundamental differences between SVN and Git, outlines the git‑svn bridge commands, and describes a self‑service migration architecture that enables large‑scale, stable migration of thousands of projects across multiple business units.

58 Tech
58 Tech
58 Tech
Migrating from SVN to Git: Concepts, Tools, and Self‑Service Design

In Q2 2019 the group launched a large‑scale migration project moving over 3,000 projects and 240 GB of code from SVN to Git across 12 business units, emphasizing smooth and stable transition.

Key characteristics of Git

Extremely fast operations performed locally.

Simple design.

Strong support for non‑linear development with thousands of parallel branches.

Fully distributed architecture.

Ability to efficiently manage massive projects such as the Linux kernel.

Unlike SVN, which stores incremental diffs for each file, Git records a snapshot of the entire repository at each commit, linking snapshots over time and generating a SHA‑1 hash for each object.

Git‑SVN bridge tool

The bridge command syntax is:

git svn<command> [<options>] [<arguments>]

Typical usage includes cloning an SVN repository while preserving full commit metadata:

$ git svn clone SVNURL --authors-file=users.txt --no-metadata -s icode-git

Authors are mapped from SVN usernames to Git email addresses (this step can be skipped if not needed).

After cloning, configure the remote Git repository and push all branches:

$ git remote add origin GitDomain:Group/Project.git
$ git push origin --all

The bridge reconstructs Git tree, commit, and data objects from SVN file data and incremental diffs, as implemented in the official source git‑svn.perl .

Self‑service migration architecture

Access layer : Provides APIs for users to initiate Git migration.

Git import thread : Uses a distributed lock to ensure that each SVN project is imported serially, preventing duplicate imports.

Shell scripts : Contain the core migration logic, leveraging the Git‑SVN bridge commands described above.

Polling scheduler : Periodically checks the import status of SVN projects and automatically terminates tasks that exceed a timeout.

SVN permission module : Revokes write permissions on the original SVN directories after migration to avoid concurrent modifications and potential source loss.

Email notification : Sends migration results, new Git URLs, and usage guidance to project owners, members, and administrators.

Infrastructure layer : iGit high‑availability service routes requests through a Proxy component and uses a Sharding service to manage metadata and multiple repository instances, enabling seamless repository switching.

Reference links

Git Community Book (Chinese): https://git-scm.com/book/zh/v2

Git‑SVN documentation: https://git-scm.com/docs/git-svn

Git source code: https://github.com/git/git

AutomationGitVersion Controlgit-svnSVN
58 Tech
Written by

58 Tech

Official tech channel of 58, a platform for tech innovation, sharing, and communication.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.