Subversion to Git Migration Checklist

/ 3 March 2012 / Alexander Celeste

Just a heads up for everyone, this post is a highly technical one for fellow developers, it is not something we expect most of you to find helpful or even fully comprehend.

Earlier this week we took the dive and migrated all of our active projects (not all of these have been publicly announced much less released) from ProjectLocker Subversion to BitBucket Git. In the process we formulated a checklist of the steps needed in this migration process. We’ve decided to post that checklist as a guide for anyone else interested in migrating projects. Please note that this checklist is entirely independent of what services you use for Subversion and Git. Anything that is within “[]” is a variable that you have to replace with the appropriate value given your setup. We hope this checklist may save you some time searching for pieces of this process on various websites.

A. Setup

  • Make sure that all changes are committed into the SVN repo from Xcode

B. Migration

  1. cd to svn checkout (project) directory
  2. svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
  3. Edit the authors-transform.txt file to match desired Git user details
  4. cd to home directory root (or any other place for the temporary Git repo)
  5. mkdir temp_git_repo
  6. cd temp_git_repo
  7. git svn init [URL-TO-SVN-REPO] --no-metadata
  8. git config svn.authorsfile [PATH-TO-AUTHORS-TRANSFORM-FILE]
  9. git svn fetch

C. Push to Git Remote

  1. git remote add origin [GIT-REMOTE-LOCATION]
  2. git push -u origin master

D. Replace SVN Version of project on filesystem/in Xcode with Git Version

  • This is self-explanatory and specific instructions for this can be found within Xcode and its documentation
  • Essentially what is important to remember is that you use the "Checkout or Clone Repository" option in the Repositories organizer and paste in the same [GIT-REMOTE-LOCATION] used above
  • You can also delete the temp_git_repo folder at this time along with the old SVN-backed project folder
Discussion