pre-commit

pre-commit checks your code for errors before you commit it.

pre-commit is configurable.

Check for merge conflicts

Make sure you don't commit a merge conflict

$ git commit

pre-commit: detected a merge conflict

lib/foo.rb:13 <<<<<<< HEAD

 

You can bypass this check using `git commit -n`

Check for console.log

Everyone adds console.log statements to help debug javascript. Make sure you don't accidentally commit one.

$ git commit

pre-commit: console.log found

public/javascripts/application.js:64 console.log('checking something');

 

You can bypass this check using `git commit -n`

More checks

pre-commit comes with a variety of checks that you can turn on or off.

Install

$ gem install pre-commit

$ pre-commit install

Bugs

Please report bugs to github's issue tracker.