Pre-push hook to save yourself from breaking build
25 of February, 2014
In order to minimize risk of accidentally breaking build
As a developer
I want code style checks and automated tests to be run each time I push code into repository.
As far as I know pre-push hook is available in git since version 1.8.2.
It lives in .git/hooks/pre-push and will run every time you push code:
If script exits with error state then git command is aborted.
Here is example script which would run php code style fixer, phpspec and behat on vagrant virtual machine:
In this example I used sample vagrant box for php projects (available from my github repository).