So, as those of you who uses git
already knows, a repository contains a hidden folder called .git
. In this folder there is a subfolder called hooks
, which is already prepopulated with example scripts with extensions .sample
.
In our case, we need a script that is run when commiting (I think?). For this the script needs to be called pre-commit
, like the example file pre-commit.sample
but without the extension. So in our case, as the script I want to run is a R script called process_blog.R
, the file should simply contains:
#!/bin/sh
Rscript blog/process_blog.R
I will need to be then given permission to execute:
chmod +x .git/hooks/pre-commit
And voilà!