Skip to content

Instantly share code, notes, and snippets.

@arjus
arjus / Magento 2 Update
Created May 15, 2018 08:23
Update Magento 2 version with composer
# Step 1 - Modify version number to composer.json
# Step 2 - Run composer
composer update
# Step 3 - Clean pre generated files
rm -rf var/view_preprocessed/*
rm -rf generated/*
@arjus
arjus / Wrong commit message
Created May 15, 2018 08:09
Change previous commit message
#Change previous commit message
git commit --ammend
@arjus
arjus / M2 local cache
Last active May 14, 2018 07:42
Speed local Magento 2 Development workflow
#enable redis and cache
php bin/magento setup:config:set --cache-backend=redis
bin/magento cache:enable
#disable block_html and full_page
bin/magento cache:disable block_html full_page
#flush xml cache through php storm
Php Storm -> Preferences -> Tools -> File Watchers -> +
@arjus
arjus / grunt commands
Last active May 14, 2018 07:59
Commands to run if grunt is not working properly
#After configuring the theme in dev->tools->grunt->configs->themes.js
grunt clean
grunt exec:theme
grunt less:theme
#while developing
grunt watch
@arjus
arjus / mysql db commands
Last active April 27, 2018 10:45
Create a new Mysql database and User with secure password
# access mysql. i'll use root as default user.
mysql -u root -p{your passwrord - default is root or admin or read mysql message after installation}
#create a new database
create database database_name;
#create a new user
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
#access permits to the new database
@arjus
arjus / Force M2 Theme deployment
Last active May 14, 2018 07:58
Commands to force Magento 2 theme deployment when static content is not getting generated
chmod -R 775 pub/static/ var/ pub/media/
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/
php -r "opcache_reset();"
php bin/magento deploy:mode:set developer
php bin/magento setup:static-content:deploy en_US -f
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento cache:clean
#example
git reset --hard f414f31
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at 2b9ee75"
@arjus
arjus / m2 new admin cli
Last active June 5, 2018 14:29
Magento 2 New Admin User
php bin/magento admin:user:create --admin-firstname=super --admin-lastname=admin --admin-email=name@email.com --admin-user=super.admin --admin-password=password!