Git hooks
In my current project we want to make sure the configurations are valid before committing any changes.
By using the git hook pre-commit we can achieve that automatically. Just put a file named pre-commit
in the .git/hooks
directory and give it executable rights (chmod +x .git/hooks/pre-commit
).
#!/bin/sh
rake validate_configs
In this example we call a rake task that does the actual validation. Now, whenever you commit something git makes sure to run this rake task before. You won't be able to commit without a valid configuration.
There are many other hooks you can use. Read more about git hooks here.
Written by Mattes Groeger
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Hook
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#