Use Version Control with Magento and Git

Almost developers want to use version control with their Magento site as well as maintain and add to the live website. Now, Git is the favorite and leading version control system of almost developers. Today, we will give you some tips and notes for you to work with Magento and Git effectively.

Choose what to include in Repository

  • Decide on the approach

You have to decide what you will store in the repository. You should create a team to do this and pull down a large Git repository containing your whole site and then pull in only a few assets from a Git repository. Your approach will dictate the rest of your Git decisions with Magento

  • Consider Databases and Configuration files

When creating a new environment, there is a relatively recent copy of the production database for use in setting up the new dev or test environment because Git team did database dumps to files inside the Git repository.

However, depending on the situation, other teams may balk at this. If the project is open source, or is open to a large section of your own company, even, you may not want to be including copies of your database files, as this would be grossly insecure. Shared amongst three developers on a private repository, for a startup app that is still under development and not in production, it might be exactly what you want. However, if you don’t put database dumps in your repository, you will need to create a process for sharing database files in order to create cloned environments as needed for development and testing.

Configuration files are treated much the same way. Typically, you are going to want to keep magento/app/etc/local.xml out of your repository if you have any security concerns at all, because of the credentials stored within it.

  • Set up the .gitignore

Setting up .gitignore is next step after you decide what you want in your Git repository. This file goes at the root of your repository, and instructs Git on file to ignore.










Git security

Baring in mind to set the permission to access to repository, permission to access to project, the private of the project before setting up the repository

Branch structure and environments

The standard project contains development, staging and production but you can add more branches as you need. You may also have temporary branches to tell theme development or custom features and merge them into the development pipeline when completed. You can perform strategy as you want but it’s necessary to plant it out, execute it and not fail into the trap of committing everything to the master branch in your repository. Branch is the main reason of using Git

Deployment Strategy

You have to decide where you will deploy using Git on the production server, which suitable version of Git and how to deploy.

With the correct planning and performances, you can get multiple benefits from using version control Magento and Git.