Change to a released version

This topic discusses how a contributing developer can change versions of the Magento software after cloning the develop branch. This might be necessary to perform some tasks that require a specific Magento version other than develop.

The develop branch is the default branch, which means you get it by default when you clone the Magento 2 GitHub repository. For some tasks, such as data migration from Magento 1.x to Magento 2.x, you must switch to a release tag.

You have the following options:

  • (Easier). If you haven’t done any customizations, you should uninstall the Magento software and reinstall it with the released version. Uninstalling not only drops the database tables, it also clears the Magento var directory, enabling you to start over with no issues.

    For more information, see Change versions by uninstalling the Magento software

  • If you have done customizations and don’t want to lose them, back up the Magento system, switch to the released branch, and install in a new database instance.

    For more information, see Change versions by installing the Magento software in a new database instance

    You can migrate your customizations (both in the file system and in the database) from the backups you made or directly using database and file system tools.

Change versions by uninstalling the Magento software

To change versions after cloning:

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Use the following command to uninstall the Magento software:

    php <your Magento clone dir>/bin/magento setup:uninstall
    
  3. Either remove your old Magento clone directory or update the Magento software.
  4. If you haven’t already done so, clone the Magento 2 GitHub repository as follows:

    git clone git@github.com:magento/magento2.git
    
  5. Change to release tag as follows:

    git checkout tags/<tag name>  [-b <branch name>]
    

    For example, to check out the 2.0.6 release tag in a new branch named 2.0.6, enter

    git checkout tags/2.0.6 -b 2.0.6
    
  6. Install the Magento software using the command line or Setup Wizard.

Change versions by installing the Magento software in a new database instance

To change versions after cloning:

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Create a new database instance for your installation.
  3. Back up the Magento file system, database, and media files:

    php <your Magento install dir>/bin/magento setup:backup --code --media --db
    
  4. Change to release tag as follows:

    git checkout tags/<tag name>  [-b <branch name>]
    

    For example, to check out the 2.0.2 release tag in a new branch named 2.0.2, enter

    git checkout tags/2.0.2 -b 2.0.2
    
  5. Manually clear Magento var directories:

    rm -rf <your Magento install dir>/var/cache/* <your Magento install dir>/var/page_cache/* <your Magento install dir>/var/generation/*
    
  6. Install the Magento software in your new database instance.

    You can install using either the command line or Setup Wizard.