When making changes to my Magento 2 site, I usually run a few of the command line commands to 'refresh' my site to see the changes I've made. The problem is, I'm not too sure what each command really does and when to use a particular one... Meaning I usually run a lot of them 'just to make sure' the site's refreshed and my changes will take effect.
When I make changes to the template layout.xml files I just use
php bin/magento cache:clean
If I make changes to the .phtml files or .php files, I usually run:
php bin/magento setup:static-content:deploy
php bin/magento setup:upgrade
php bin/magento cache:clean
and php bin/magento cache:flush – just to make sure!
I have no doubt this is overkill and I'm using some commands unnecessarily.
Could someone explain what each command actually does and when (and why) it would be correct to use each one?
Here's a list of commands which I think would be useful to know the reasons for using each of them:
php bin/magento cache:cleanphp bin/magento cache:flushphp bin/magento setup:static-content:deployphp bin/magento setup:upgradephp bin/magento setup:di:deploy
For example, if I were to update a .phtml file, which commands should I run to make sure I see my changes? A .php file? layout.xml files?
Thank you!