What is a Git hook?
What is Overcommit?
Overcommit is a tool that makes managing your hooks less of a pain in the ass.
Add to your
Gemfile and run
group :development, :test do gem 'overcommit' end
Install the hooks for your project and generate a
.overcommit.yml config file:
overcommit --install overcommit --sign # May need to run if you get an error
Add a hook
Let's setup a pre-commit hook to run Rubocop. Edit your
PreCommit: RuboCop: enabled: true on_warn: fail # Treat all warnings as failures
Overcommit has a bunch of built-in hooks but you can also add custom hooks if needed.
List hooks in project