0
Migrate from SVN to GIT with history
Recently we decided to switch from SVN to GIT at my new gig. There is a plethora of information on the web regrading git-svn hybrids, running them in parallel, etc but thats not what we want. We wanted to just cleanly migrate from SVN keeping all the history and deprecate the old SVN repo. The best info I found was Jon Maddox’s fix but that didnt work entirely so here is the summary of how it all works in a few simple steps.
1 2 | cd ~/Desktop vim users.txt |
Insert a list of your users as shown below. If you forget any the fetch will fail but dont worry, the error will contain the missing email address.
johnclarkemills = John Clarke Mills <john@gmail.com> somedude = Some Dude <dude@gmail.com>
Here comes the fun part:
1 2 3 4 5 6 7 | mkdir my_blog_tmp cd my_blog_tmp git svn init http://svn.location.com/trunk/ --no-metadata git config svn.authorsfile ~/Desktop/users.txt git svn fetch cd .. git clone my_blog_tmp my_blog |
Now the final step. Your repo is all setup locally, but it isnt linked to any remote GIT repo. Here is the final step that got me all setup.
1 2 | cd my_blog vim .git/config |
Now all you have to do is replace the urls in there with your git repo’s url like so: john@git.location.com:my_blog.git. Save the file, and now your all set, history included!
1 2 | git pull git push origin master |
Categories: Computers, Software