Hello guys. This is our first article. And we would like to tell you how we orginize Magento development environment in our company. As you know there is a major rule #1 for magento "Never ever edit the core". So how to prevent editing the core files? The simple way is adding all the Magento core files to .gitignore. Even if somebody modified this file they will not commit the changes. There is a good service that allows you to generate .gitignore files for a lot of projects https://www.gitignore.io/. But how we should up the environment in a simple way so even QA or designer can up it on their local machine? So follow these instructions
First of all you need to create a repo and commit your .gitignore file
#init repository
git init
#that's you repo address on github or bitbucket
git remote add origin git@bitbucket.org:hexbrain/repo.git
#stage file
git add .gitignore
#commit file with message
git commit -m 'Added .gitignore'
#push changes to master branch
git push origin master
If you already have a repo with changes you just need to run
git clone git@bitbucket.org:hexbrain/repo.git ./repo
You can download Magento here http://www.magentocommerce.com/download and unpack it to your project folder, or better way is to create a repository with clean Magento (or use the existing one https://github.com/OpenMage/magento-mirror and pull Magento files to the project). Second way is better because run list of instructions is more simple for people who have no idea what they're doing. So the following subitems are for people who chose the second way:
git remote add -f magento https://github.com/OpenMage/magento-mirror.git
git merge -s ours --no-commit magento/master
git read-tree --prefix='/' -u magento/master
git reset .
Also you need to set 777 permission to the folders media/
, var/
, app/etc/
The final step is installing Magento or extracting existing database dump.
After this we can make a list of commands that allows anyone to setup your magento project on local machine and it will prevent core files editing. The following instructions:
git clone git@bitbucket.org:hexbrain/repo.git ./repo
git remote add -f magento https://github.com/OpenMage/magento-mirror.git
git merge -s ours --no-commit magento/master
git read-tree --prefix='/' -u magento/master
git reset .
web/secure/base_url
and web/unsecure/base_url
in table core_config_data
to your values or run installation processThat's how you can configure Magento environment and prevent core files editing. Notice: There is one issue. When you install third party extensions to your project often they have a theme files placed into base/default folder, so you just need to copy all of these theme files (app/design, skin/) to your theme to be able commit them. That's all, we would like to hear about your experience in configuring Magento environment. Thanks for reading.