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 have not 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 do not 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:
- Log in to your Magento server as, or switch to, the Magento file system owner.
-
Use the following command to uninstall the Magento software:
1
php <your Magento clone dir>/bin/magento setup:uninstall
- Either remove your old Magento clone directory or update the Magento software.
-
If you have not already done so, clone the Magento 2 GitHub repository as follows:
1
git clone git@github.com:magento/magento2.git
-
Change to release tag as follows:
1
git checkout tags/<tag name> [-b <branch name>]
For example, to check out the 2.2.0 release tag in a new branch named
2.2.0
, enter1
git checkout tags/2.2.0 -b 2.2.0
- 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:
- Log in to your Magento server as, or switch to, the Magento file system owner.
- Create a new database instance for your installation.
-
Back up the Magento file system, database, and media files:
1
php <magento_root>/bin/magento setup:backup --code --media --db
-
Change to release tag as follows:
1
git checkout tags/<tag name> [-b <branch name>]
For example, to check out the 2.2.0 release tag in a new branch named
2.2.0
, enter1
git checkout tags/2.2.0 -b 2.2.0
-
Manually clear Magento
var
directories:1
rm -rf <magento_root>/var/cache/* <magento_root>/var/page_cache/* <magento_root>/generated/code/*
-
Install the Magento software in your new database instance.
You can install using either the command line or Setup Wizard.