How to update Magento 2?

First of all, you have to own Magento 2 installed and then log in as Magento server user with permissions to write to the Magento 2 file system.

Next, you must ensure that you can run Magento commands from any directory. So, to warrant, add <your Magento install dir>/bin to your system PATH.

Update Magento 2

Step 1:

Log in as a user with permissions to modify files in the file system of Magento

Step 2:

Save all changes to composer.json since following actions will cover it:

cd <your Magento install dir>

cp composer.json composer.json.old

Step 3:

Use the following guide, in case when the optional sample data has been installed:

rm –rf dev/tools/Magento/Tools/SampleData/

Step 4:

Update your local repository to get the latest code:

git pull origin master

There are two main branches in Magento 2 GitHub repository: master and develop. Master provides the most updated version of code and develop serves some new features and repairs which are not ready for production.

Step 5:

With the support from composer update, doffing and merging composer.json.old with composer.json installed with Magento 2 software.

Step 6:

Run the command php bin/magento setup : upgrade to update Magento 2 data after manipulations with composer.json.

Step 7:

Finish the final step by running command rm –rf var/generation/* var/cache/* to clear var directory contents.

It is all about updating Magento 2. If you have any problems in the update process, contact us for the help.