1. Create a user file of authors from your existing svn. This file should be of the form: 

    john = John Mehan <john.mehan@irdeto.com>
    

    You can extract the authors from svn by using the following one liner:

    svn log --xml | grep author | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = /' | tee users.txt
  2. Then download the svn data into a GIT repository:

    mkdir repo && cd repo
    git svn init http://subversion/repo --no-metadata
    git config svn.authorsfile ~/users.txt
    git svn fetch
  3. When completed, Git will checkout the SVN trunk into a new branch. Any other branches are setup as remotes. You can view the other SVN branches with:

    git branch -r 
  4. Clone your GIT-SVN repository into a clean Git repository:

    git clone dest_dir-tmp dest_dir
    rm -rf dest_dir-tmp
    cd dest_dir


  5. The local branches that you created earlier from remote branches will only have been copied as remote branches into the new cloned repository. (Skip trunk/master.) For each branch you want to keep:

    git checkout -b local_branch origin/remote_branch


  6. Finally, remove the remote from your clean Git repository that points to the now deleted temporary repository:

    git remote rm origin


  • No labels