---
author: Jan Brennenstuhl
canonical_url: https://www.janbrennenstuhl.eu/svn-to-git/
description: 'Version Control System (VCS) Migration: A short guide on how to migrate SVN to GIT while preserving source code authors and commit history.'
id: jb-svn-to-git
kind: essay
license:
  name: CC BY 4.0
  scope: Original text; credited third-party media retain their own rights.
  url: https://creativecommons.org/licenses/by/4.0/
markdown_url: https://www.janbrennenstuhl.eu/svn-to-git/index.md
modified: '2025-06-01T00:00:00+02:00'
published: '2015-04-15T00:00:00+02:00'
review_basis: publication
review_status: reviewed
reviewed: '2015-04-15'
series: ''
status: published
title: How to Migrate SVN to GIT with History?
topics:
- engineering-practice
---

# How to Migrate SVN to GIT with History?

Version Control System (VCS) Migration: A short guide on how to migrate SVN to GIT while preserving source code authors and commit history.


Today I'd like to share my solution for a common problem a lot of IT companies experience when finally moving from Subversion (SVN) to Git as their central version control system (VCS): Converting a SVN repository into a Git repo including its commit history and authors.

To achieve this, I decided to split this issue into smaller pieces:

1. Extracting all authors of the SVN repository,
2. Creating a proper authors file mapping SVN users to Git users,
3. Converting SVN repo to Git including its history and authors.

Here is what I did:

<a id="converting-svn-to-git-w-history--authors"></a>
## Converting SVN to GIT w/ History & Authors

Checkout your SVN repository.

```bash
svn co SVN_REPO_URL
```

Go into the repo directory and extract authors from the SVN repo [using this statement](http://stackoverflow.com/questions/2159567/what-is-the-format-of-an-authors-file-for-git-svn-specifically-for-special-char).

```bash
svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /'
```

Using this information, create an authors.txt file like this:

```bash
# SVN_AUTHOR_HANDLE = GIT_AUTHOR_HANDLE <GIT_AUTHOR_EMAIL>
jbrennenstuhl = janbrennenstuhl <xyz@brnnnsthl.eu>
...
```

Using this file you now can start converting your SVN repo into a Git repo.

```bash
git svn clone -A authors.txt SVN_REPO_URL
```

This will convert the old SVN repo into a new Git repo including the complete SVN history and mapping its authors following the mapping in authors.txt. Depending on the dimension of the SVN repo history, this can take several minutes or even hours!

If you don't want to have the entire SVN history you could choose to start from a specific revision like this:

```bash
git svn clone -rSVN_REVISION:HEAD -A authors.txt SVN_REPO_URL
```

Still using SVN? Start converting to Git now!

---

Cite as: Jan Brennenstuhl. "How to Migrate SVN to GIT with History?." Brennenstuhl on Security, 15 April 2015. https://www.janbrennenstuhl.eu/svn-to-git/
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) for the original text; credited third-party media keep their own rights.
