Makeshift Spock in Statamic 3 with Laravel Forge

Published on February 18th, 2020.

There’s no need for a makeshift Spock if you can get a real Spock! Read about Statamic 3’s Git integration.

I've been using Statamic 3 on a few of my recent web projects. For the most part it's fantastic but one thing I'm missing, at least for now, in my production Statamic 3 sites is that Spock hasn't been updated for v3.

If you're not aware, Spock is a first-party Statamic addon which does a Git commit every time something is created, saved, deleted etc.

It helps to keep all of your Statamic entries, collections, taxonomies in version control and up-to-date at all times.

Right now Statamic 3 is still in open beta and the gents haven't got round to porting Spock for v3 so I thought of making my own way.

It was actually a really simple fix.

Like others in the Statamic community, I use Laravel Forge for all of my server provisioning, site management, deployments, that sort of thing.

The closest thing I could think of is to create a scheduled command in Forge that stages, commits and pushes any file changes every hour.

To configure it. Go to the server that's hosting your Statamic site, click on the Scheduler page and create a new scheduled command.

Here's what my scheduled command looks like:


In case you couldn't catch it, here's the full command:

cd /home/forge/ && git add . && git commit -m "Updates from production" && git push

Remember to replace /home/forge/ with the path of your Statamic site.

Once you've got that setup, every hour, Forge will attempt to commit and push file changes up to your Git remote.

It's not quite the same as Spock as it executes the Git commands as soon as you create or update an entry but this is one way of dealing with no Spock in v3 for now.

My picture

Duncan McClean