Skip to content

Instantly share code, notes, and snippets.

@llekn llekn/
Created Jun 9, 2017

What would you like to do?
Overcommit overview



Overcommit is a gem that makes easy to add, configure and run tasks on git hooks (script that are run when manipulating a git repo, for example, before making a commit).


  1. Add the gem overcommit to development environment, or install it globally on you machine with gem install overcommit
  2. On the project on which you want to use overcommit, install the git hooks provided by overcommit: overcommit --install
  3. Configure overcommit to run the tasks that you want by editing the .overcommit.yml faile.
  4. As a security measure, each time that you make changes to the .overcommit.yml file or to the git hook you need to "sign" the configuration again (to prevent running malicious scripts that could be added in a remote commit). So, as last step you have to run overcommit --sign


A minimal .overcommit.yml config file that only runs rubocop before a commit looks like:

   enabled: true
   on_warn: fail

A very nice overcommit configuration that runs rubocop and eslint can be found at:

For a complete list of available hooks you can check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.