Git Overview

SpinupWP fully supports Git-based sites out-of-the-box, including support for Bedrock. We have our own git and Composer template, which is designed for SpinupWP. You can even configure push-to-deploy so that any code changes are automatically deployed to your server as they’re pushed to a Git provider like GitHub or Bitbucket.

How It Works

Whenever a Git deployment is triggered (either manually or via push-to-deploy), SpinupWP will SSH into your server and perform the following commands:

git remote update
git checkout -f BRANCH

This will overwrite any modified files within the site’s files directory that are managed by Git. Files that aren’t managed by Git, or files specified within a .gitignore won’t be modified or deleted.

For example, let’s say you modified the wp-config.php file on your server, but you also store this in Git. The next time a deployment is triggered, the wp-config.php file will be overwritten on the server and your changes will be lost.

Running Git Commands

SpinupWP uses a mirror repo to deploy your site to the server. This means that you can’t run Git commands directly from the files directory. Although you shouldn’t need to run Git commands directly on your SpinupWP server, it can be useful in some scenarios. For example, you may want to see which files are in your site’s files directory but aren’t stored in Git.

When running Git commands, you should run them from the site’s root (i.e. /sites/yourdomain.com/), and you must specify both the Git and working directories:

git --work-tree=./files --git-dir=./git status

Advanced Git Deployments

While the SpinupWP push-to-deploy feature is very useful, it only covers the basics of what is possible with automated deployments. Tools like Buddy and DeployBot allow for much more advanced automated deployment systems, including things like atomic deployments, isolated build environments, abort deployment on build failure, and integrations into various third-party tools. We recommend reading the automated deployments section of our Deploying WordPress guide for more details on how to use these tools.