Skip to content

Instantly share code, notes, and snippets.

@flodolo
Last active August 29, 2015 14:21
Show Gist options
  • Save flodolo/c982a469943a096ae0d8 to your computer and use it in GitHub Desktop.
Save flodolo/c982a469943a096ae0d8 to your computer and use it in GitHub Desktop.
Convert SVN mozilla.org to Git

Based on http://john.albin.net/git/convert-subversion-to-git

Create a list of all SVN users

This step is not necessary if you already have such a file.

I already created a cleanup file for mozilla.org, the result is in this test repository.

Clone the SVN repository

svn co http://svn.mozilla.org/projects/mozilla.com/trunk/locales/ mozillaorg_svn

Lists the authors in the repository and redirect the output to a text file

svn log -q mozillaorg_svn | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors_mapping.txt

Convert repository to Git

Clone the repository with Git

git svn clone http://svn.mozilla.org/projects/mozilla.com/trunk/locales/ --no-metadata -A authors_mapping.txt mozillaorg_git

If "git svn" is not recognized as a valid command, install the package 'git-svn'.

Further updates

cd mozillaorg_git
git svn fetch -A ../authors_mapping.txt
git reset --hard refs/remotes/git-svn
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment