Skip to content

SVN to Git Migration

Rick Pernak edited this page May 11, 2020 · 1 revision

There are a couple ways to migrate from SVN to Git version control:

  1. git svn clone
  2. svn2git

We use item 2 because it is a little more straightforward. However, this does not come as a standard install on our Linux systems (e.g., CentOS 6 or 7), so item 1 might be more preferable if one does not have access to svn2git. We have not provided all of the arguments for item 1.

# first check out the SVN repo
% svn co https://svn.aer.com/svn/aer/project/RD/RRTMG_SW/trunk RRTMG_SW
% cd RRTMG_SW/

# grab list of authors, save it for Git repo
% svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-rrtmg-lw.txt
% mv authors-rrtmg-lw.txt ..
% cd ..
% mkdir Git_RRTMG_SW
% cd Git_RRTMG_SW/
% mv ../authors-rrtmg-lw.txt .

# add (no author), otherwise migration does not complete
% cat authors-rrtmg-lw.txt
 =  <>
miacono = miacono <miacono>
mike = mike <mike>
(no author) = no_author <no_author@no_author>

# merge two repositories, keeping trunk, branches, and tags and inhibit `svn2git` from automated URL determination
% svn2git https://svn.aer.com/svn/aer/project/RD/RRTMG_SW/ --authors authors-rrtmg-lw.txt --no-minimize-url
% git remote add origin [email protected]:RC/RRTMG_SW.git
% git push --all origin
% git push --tags origin
Clone this wiki locally