Magento 2 Source Code Control with Git and Bitbucket
Marco de Vries
January 12, 2016
7 min lezen
Marco de Vries
January 12, 2016
7 min lezen
In this blog I will describe how we set up source code version control using Git and Bitbucket.
We wanted a few things for our source code management:
These elements played a part in our approach:
Choosing Git to do source code control is a no-brainer these days. Since it is a distributed version control system, it ensures that the full repository is copied to all the locations where it is used. So the source code is safe. Completely fathoming its power takes a lot of time, but the day-to-day tasks are easy to learn.
Github and Bitbucket are the most common online source code hosting services. Github is the most popular of the two for publicly accessible source code, but our source code needed to be private. Bitbucket provides free access to unlimited public and private repositories for up to 5 users. It’s fast and provides a useful web interface. We are very happy with Bitbucket 🙂
We create a separate repository for each shop. This repository leans very strongly on its .gitignore file. This simple file determines which files to include into the repository. We follow Alan Kent’s recommendations in this. Most importantly, the vendor directory is excluded from the repository. This includes the Magento 2 core, its dependencies, and all public third-party extensions.
The shop repository contains our shop-specific custom code, located in app/code and app/design. Also included are the paid third-party extensions that the shop uses.
Next to these shop repositories we also develop common extensions that we can use for several shops. Each of these extensions will get its own repository and is managed by Composer, just like the public third-party extensions.
Taken together, the shop consists of a main repository and zero or more of our own extensions. These extensions live inside the vendor directory and each has its own Git checkout.
Laten we er eens over kletsen, onder het genot van een goede kop koffie!