We push our local changes to bitbucket specific/feature branches created from the stage(develop) branch.Stage branch is with the latest changes.
For deploying our code from our local environment to stage or live we usually follow these steps:
We push our local changes to bitbucket specific/feature branches created from the stage(develop) branch.
Then stage(develop) branch is with the latest changes.
So now whenever we need to put the next version for release we merge stage(develop) into the master(main) branch. When our code is merged with master(main) without any conflicts we are good to go and we can push that in our server.
After we go to our server address basically by terminal connecting to the IP with the credentials, we search for our project root for e.g -> MyProject/htdocs.
Later in htdocs, we run commands:
git fetch –all (Fetch all of the branches from the repository) and,
git reset –hard origin/master (make it excatly like origin/master branch).
This way we have all the changes from bitbucket also to our server.
If we made only logic and front end changes in features (CSS only) we need to run these two commands in Shopware 6:
bin/console cache:clear – (gets rid of all kind of cache)
But if we also had some JS changes we need to run also the build.js command:
After we go to our shop in the browser and hit ctrl shift R (hard refresh to clear the cache), we will be able to see our latest changes.
In Shopware 6, If we want also to import our database changes from our local to staging, it’s better to do that by terminal command than UI because the UI will time out.
mysqldump -u username -p database_name > data-dump.sql (export). This is the command if we want to export a database.
mysql -u username -p database_name < /path/to/data-dump.sql (import). This is the command if we want to import a database.
If you want to know more about e-commerce development platforms or apps, read our blog posts for Shopify and Shopware. Our dedicated outsourcing team can be your collaborator in ecommerce.