SVN to Git

Converting a SVN Repository to Git

  1. Make sure you have read permissions to the to be converted SVN repository, see

  2. Clone existing svn repo:

    git svn clone --username=${USER}${REPO}
  3. Prepare authors file:

    cd ${REPO} &&
    git log | awk '/^Author: / { print $2 }' | sort -u > ../${REPO}-authors &&
    cd ..
  4. Manually complete authors file with entries like this:

    bad9 = Daniel Baumann <>
  5. Clone existing svn repo again:

    git svn clone --authors-file ${REPO}-authors --localtime --no-metadata --preserve-empty-dirs --username=${USER}${REPO} ${REPO}-git


Depending on the repository history, you might not want to use --preserve-empty-dirs

  1. Convert svn ignore to git ignore:

    cd ${REPO}-git &&
    git svn show-ignore > .gitignore &&
    git add .gitignore &&
    git commit -a -s -S -m "Converting svn:ignore properties to .gitignore." &&
    cd ..
  2. Create a new Git repository on

    ssh create staff/${USER}/${REPO}
  3. Upload converted repository to

    git remote add origin${USER}/${REPO}.git && git push --all
  4. Login to and change set the creator to the user you have migrated the repository for:

  5. Write the user a email following the template, and also mention the location of the converted repository.

Splitting converted repository into multiple repositories

  1. For every new ‘small’ repository create one copy from the ‘big’ repository.

  2. In every ‘small’ repository remove all unwanted files:

    git filter-branch --tree-filter 'rm -rf ${FILES|DIRECTORIES}' HEAD

Manual checks

  • check for multiple branches
  • check for tags