Last Updated: February 25, 2016
·
1.934K
· hauleth

Be sure that your commit pass tests

Some times I've add some awesome code to my application and when I'm still euphoric I give it a commit and push it to repo. But some time after that I get mail from Travis CI that my new awesome code break some app and do not pass all tests. So I've got my mind and write this:

#!/bin/sh

rake spec

and save it as .git/hooks/pre-commit. Then before every commit git will run all your RSpec test. Pretty awesome, huh?

PS
If you wanna to omit tests before commit just run

$ git commit --no-verify

or

$ git commit -n