GitHooks
Some usefull git hooks, it's written on ruby but can be used for other languages.
Installation
Add this line to your application's Gemfile:
gem 'git-hooks'
And then execute:
$ bundle
Or install it yourself as:
$ gem install git-hooks
Usage
Install git_hooks on project.
$ git_hooks install pre-commit [--force]
Create configuration file
Create a .git_hooks.yml on project root.
$ git_hooks init
By now you will find only some simple hooks to:
- Prevent commit on master.
- Prevent commit with rubocop offences.
- prevent commit with broken rspec tests.
- prevent commit with debugger
Ensure hooks existence
To ensure that hooks exists on .git/hooks, include on your application
start up (probably config/environments/development.rb or
config/environments/test.rb)
GitHooks.validate_hooks!
This will force git_hooks installation before your application start.
Contributing
- Fork it ( https://github.com/stupied4ever/ruby-git-hooks/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request




