Оvercommit - convenient Git hook manager

Voldemar Duletskiy, Ruby developer, Evrone, Moscow Ruby Meet-up 6 report
01 August   772

Dynamic, open source programming language with a focus on simplicity and productivity, it has an elegant syntax that is natural to read and easy to write.

Hello Ruby fans! Today we will talk about Overcommit - the convenient management of git-hooks.

Imagine that you have a small project with a micro-team of three or four people, including the manager. Deadline is near, but you cannot lower the quality of the code. You don't wanna use CI and there are no extra money for it.

What is hooks and where are they located?

It is the scripts that are executed at certain event. You can view all existing hooks by running the following command:

ls -la .git/hooks

You will see this listing:

-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 commit-msg
-rwxr-xr-x   1 voldemar  staff  3755 28 июн 16:39 overcommit-hook
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 post-checkout
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 post-commit
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 post-merge
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 post-rewrite
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 pre-commit
-rwxr-xr-x   1 voldemar  staff   673  2 Jun 14:37 pre-commit.sh
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 pre-push
-rwxr-xr-x   1 voldemar  staff  3755 28 Jun 16:39 pre-rebase

Hook is an executable file, which can content anything, including the Ruby code.

Why it is cool?

  • You can put linters like rubocop to the pre-commit hooks. It will not allow you to commit substandard code
  • You can hang up rspec to the pre-push hooks, and if the tests are dropped - cancel code sending
  • If you are already actively using hooks - you don't need to drag them from one repository to another, they all lie in .ovecommit.yml in a convenient format

Ruby static code analyzer, based on the community Ruby style guide

If you suffer from dispersion and you are sick of messages from your CI that tests have dropped again, or the ruby-cop found a million syntactic violations (or your colleagues in the code-review process). If you are an experienced developer, a good set of hooks seriously discourages young developers and reduces your code-review time. 



gem 'overcommit'

Execude from the consol:

bundle exec overcommit --install

 Now let's edit .overcommit.yml file

    enabled: true
    command: ['bin/bundle', 'exec', 'rubocop', '-R']
    on_warn: fail
    enabled: true
    command: ['bin/bundle', 'exec', 'haml-lint', 'app/views/']
    on_warn: fail
    enabled: true
    command: ['bin/bundle', 'exec', 'scss-lint']
    include: 'app/assets/**/*.scss'
    on_warn: fail

    enabled: true

We can see here that the launch of the rubocop scripts is describled in nice forman. haml-linter, sccs-linter and tests runs just before the commit.

In order to enforce hook running this should be executed:

bundle exec overcommit -R

Now, with every attempt to commit something, checks will be performed firstly.


Underwater rocks

If there are a lot of tests or they are dropping randomly - if you already have a habit to brew coffee while test runs, it's better to chop the hook responsible for running the tests. If they fall randomly - fix the tests at last, damn it.

Integration with Rubymine - I have serious problems with the integration of Overcommit and Rubymine

Continuous Integration

The practice of merging all developer working copies to a shared mainline several times a day

Overcommit and CI integration - if you still decide to connect CI, then most likely it already provides validation for the code. Often, their rules don't match and you have to adjust the settings, for example Rubocop under CI, or vice versa.

You can skip hooks by running git commit --no-verify


Overcommit is an excellent utility for maintaining a project in good shape for small teams. It will allow you not to grab your head every time after creating a pool of the requester with exclamations "Damn, I forgot to use rubocop again!" or "Damn, all the tests fell!".

Ruby Meditation #19 in Kiev

Sat, November 25, 2017, 11:00 AM – 6:00 PM EET Hub 4.0, Yaroslavskyi lane 1/3, Kyiv, Ukraine
23 November   374

Join next Ruby Meditation #19 on November, 25th! Become a part of Ruby Community.

Take your new knowledge, useful practice, and joy. Organizers are waiting for speakers from Toptal and it's mean interesting topics and discussion. Join and get information about hard and soft skills in ruby-development. Starting at 11:00 and finishing at 18:00 with the coffee-breaks and a tasty lunch.


  • 11:00 Registration and Welcome coffee 
  • 11:30 How freelancing and remote work is changing the world - Ines Avdic-Zekic
  • 12:15 Coffee break
  • 12:30 Monads in Ruby - Victor Zagorodny
  • 13:15 Lunch
  • 14:15 # UDD Kick Off - Marek Piasecki
  • 15:00 Coffee break
  • 15:15 Microservice communication with RabbitMQ - Tetiana Chupyra
  • 16:00 Coffee break
  • 16:15 A toolbelt of seasoned bug hunter - Damir Zekic
  • 17:00 Coffee break
  • 17:15 Lightning Talk


There will be interesting talks of skilled coders at Ruby Meditation.

Ines Avdic-Zekic

Topic: “How freelancing and remote work is changing the world

Ines Avdic-Zekic
Ines Avdic-Zekic

How to gently break into freelancing (with Ruby on Rails) and take control of your life and career.

Ines Avdic-Zekic

Ines Avdic-Zekic travels the world, looking for top 3% freelance talent, whom she makes feel at home while working with Toptal. She also trainer/teacher. She started teaching very early in her career, but moved to curriculum design/creation and eventually completely changed her interest to technology and Technical recruitment. She a member of Toptal’s Speakers Network. 

Victor Zagorodny 

Topic: “Monads in Ruby

Victor Zagorodny
Victor Zagorodny

Monads are mentioned more and more often in various talks, and discussions, but mostly about pure functional languages and... JavaScript. We are going to take a closer look on what monads are, in what typical use-cases they can be applied to make our code elegant and our life simpler. Also we’re going to review the current state of monads support in Ruby community and put our two cents in this.

I am a Senior Ruby developer and a tech lead @ Sloboda Studio, write mostly in Ruby, have passion for Haskell and pure functional programming in general.

Victor Zagorodny

Marek Piasecki

Topic: “# UDD - kicking of Understanding Driven Development

Marek Piasecki
Marek Piasecki

This presentation will be a natural continuation of Odessian # Hype Review. Thanks to your questions and feedback I’ll try to give some answers. I do believe deep understanding is a key thing in development. It’s kind of obvious. But we go further and further with reducing scope of our specializations.  We’re learning how to use tools and methodologies instead of learn in the first place how to program.

Marek Piasecki

Damir Zekic

Topic: "A Toolbelt of a Seasoned Bug Hunter"

Damir Zekic
Damir Zekic

Loud bugs are easy to spot and easier to fix. But there are subtle bugs that work over time and only in specific environments. Finding and fixing them is often a frustrating process. This talk will cover a debugging odyssey through which we will explore and evaluate various tools that can be used for better understanding what is happening in any application.

Damir Zekic

Sixteen years ago Damir started developing web applications with PHP, but switched to C#/ASP.NET (he tries not to remember those few projects he was forced to implement with VB.NET) until he saw the radiant shine of Ruby. Developing web apps for the majority of his career as a software developer, he’s proficient with both back-end and front-end work, but recently started to focus on the back-end more. Enthusiastic about functional programming. He is also a part of Speakers Network in Toptal.

Tetiana Chupyra

Topic: "Microservice communication with RabbitMQ"

Tetiana Chupyra
Tetiana Chupyra

Microservice applications are useful only if they work in cooperation. So an adequately chosen type of inter-service communication is golden. In this talk, I want to speak about building lightweight microservice messaging with a usage of RabbitMQ. Why it’s better than standard JSON over HTTP? When it should be used and when should not? How to integrate RabbitMQ in Ruby application? I have some thoughts and answers that I want to share with you all.

Tetiana Chupyra

Organizers do appreciate a willingness to learn, thus, students receive 50% discount by promo code ‘student’. Please send your student ID’s scan to make your registration faster.
If you are on maternity leave with a small baby (0-3 years) you can get a special discount for a ticket with promo code ‘GrowWithYourKid’. Please take kid’s birth certificate with you to confirm the status.

Get your ticket here