Bedrock - Version control - how to properly set it up?

Hello,
I want to start a new project based on Bedrock and Sage. My plan is, to work locally - put everything in version control at a service like beanstalk and deploy it from there to my test and production environment.

  1. I downloaded bedrock and run the composer to install necessary dependencies.
  2. Then I navigated to /themes/ and cloned sage into this folder.

I am now wondering how is version control supported and I assume that I would put everything in version control except my /uploads/ folder. The gitignore of bedrock shows nearly every file to be excluded from version control, but why? I would now edit this file and only leave /uploads/ inside of the gitignore file.

In case wordpress or plugins needs to be updated, I would change my composer file, run composer and check in the changes.

Is this the correct way of handling this?

Thanks for any suggestions!

Anything that is managed by a package manager (Composer for Bedrock, npm for Sage) is Git ignored.

The correct way of handling it is to run Composer and Npm on your server - where you deploy to.

Thanks for your help Scott. However, Sage uses composer as well, does it? I have a composer.json file in my sage folder, not npm?

So I added woocommerce to my bedrock composer.json and checked in this file. Another developer who will begin working with this repo will clone this composer.json and run composer install to set up his environment. Got it.

Correct!

Sage is a Composer package but also uses npm (see package.json). Themes are more complicated.

1 Like