Bin/grav clear-cache everytime I git pull newest changes on my production server

I want to run bin/grav clear-cache automatically everytime I git pull the code from my Bitbucket. Since I have cache on for all my assets, right now if I just git pull something the visual changes (to CSS files and so on) won’t be visible without cleaning the cache.

I believe this has something to do with git hooks. How to set this up?

You can create a bash script like

#!/bin/bash
cd somewhere/grav
git pull
bin/grav clear-cache

@flaviocopes where in git hooks I should put this?

A githook has to call a web URL. So you would need to exec a bash script from a php file. Be careful though, this can easily be abused and potentially causes problems for your site.

BTW Grav should automatically do a cache rebuild when any page or config file changes, so is this really needed?

@rhukster - in my case Grav doesn’t clean the cache automatically when I do changes to CSS files so I need to do it myself :frowning:

I take it you are using CSS pipeline. This should be addressed in the imminent release of Grav 1.1