Jump to content

Migrating from SVN to Git

From mediawiki.org

So, you've got a SVN checkout of a development or a production Wiki, and you want to change it to a Git one...

Core (nee "phase3")

[edit]
This is currently untested and somewhat of a brain dump!

This is based on your wiki being at /var/www, with the wiki files in the w directory .

  1. Make a backup of your files (doing your database aswell wouldn't be a bad thing)! If you want to keep any changes you've made to mediawiki code, save the results of
    svn diff
    .
  2. Strip out all the old .svn folders (though, we possibly don't want to delete the ones from the extensions. Hmmm)
    cd /var/www
    find ./w -name ".svn" -type d -exec rm -rf {} \;
    
  3. Do a Git clone into a new folder
    Anonymous:
    git clone https://gerrit.wikimedia.org/r/mediawiki/core.git git
    Wikimedia developer account:
    git clone ssh://<USERNAME>@gerrit.wikimedia.org:29418/mediawiki/core.git git
  4. Change this Git clone to the wanted version
    cd git
    
    To make your Git clone use a branch:
    git checkout origin/REL1_18
    To make your Git clone use a tag:
    git checkout 1.18.2
  5. Copy this git clone over your SVN files
    cd ..
    cp -ra git/. w/
    
  6. Party!

Future updates

[edit]

So, you need to do some updates, due to security updates, new releases or whatever. See Download from Git#Switching to a different version

Migrating extensions

[edit]

Some extensions have been moved to Git, some are still in Subversion. In the future this won't be the case, but now it is. Any extensions that are deployed on the Wikimedia Cluster have been migrated, along with some others at the authors request.

A similar process to what was done to migrate core (phase3) can be used for extensions.

See also

[edit]