Use git-hooks to make sure you never check in ugly code again

The git-hooks project provides a way to run git hooks locally before you check in your code. This is especially useful if your code is hosted on GitHub because you don’t have access to install server side hooks.

From the README:

Hooks can be very powerful and useful. Some common hooks include:

- Spell check the commit message.
- Check that the code builds.
- Verify that any new files contain a copyright with the current year in it.

Hooks can be very project specific such as:

- Verify that the project still builds
- Verify that autotests matching the modified files still pass with no errors.
- Pre-populate the commit message with the ‘standard’ format.
- Verify that any new code follows the ‘standard’ coding style.

or very specific to one person such as:

- Don’t allow a push to a remote repository after 1am in case I break something and will be asleep.
- Don’t let me commit between 9-5 for projects in ~/personal/ as I shouldn’t be working on them during work hours.

I wrote some hooks for checking PHP syntax and checking Python files using PEP-8 and PyFlakes.

Hopefully they’ll integrate this functionality into the git core at some point.

  • http://www.pessinlaw.com/miami-car-accident-lawyer/ Miami Car Accident Lawyer

    “You almost have flashbacks of it — of how ugly it was — in many ways, on every island,” said Hamilton, 51, executive director of the YWCA of Kauai. Yesterday, as she and her partner, Noelle Cambeilh, witnessed history with the governor’s approval of …

  • http://www.trenbolone.org/trenbolone-enanthate.php trenbolone enanthate

    The code of silence has reared its ugly head again,” Mrs. King told the Globe in 1994, when a friend’s son was shot in the head. “We’ll know by morning who did it, but watch how many witnesses come forward.” Turning anguish into action, …

  • http://www.pessinlaw.com/miami-car-accident-lawyer/ Miami Car Accident Lawyer

    Brian Shramek, Williamsburg, Mo., Git Er Dun Deere, 233.12′. From Salem, Ohio, Carlton Cope finished seventh with a run of 231.07 feet aboard Warpath, and Mike Linder, of Edison, Ohio, went 230.20 feet with Linder Brothers, to

  • http://www.trenbolone.org/trenbolone-enanthate.php trenbolone enanthate

    Under the collaboration, Oracle and Fujitsu “will advance joint engineering efforts” that make sure that products from both companies are optimized and tested to “best run Oracle software in mission critical environments.” It is not clear if this only …

  • http://www.pessinlaw.com/miami-car-accident-lawyer/ Miami Car Accident Lawyer

    I like fat people. I don’t like republicans.

    Hopefully one is not a requirement for the other.

  • http://www.pessinlaw.com/miami-car-accident-lawyer/ Miami Car Accident Lawyer

    I like fat people. I don’t like republicans.

    Hopefully one is not a requirement for the other.

  • Michael Chletsos

    Github is great, possibly one of the greatest services to come out recently, but since they do not allow server-side hooks, some workflows are rather limited. Assembla.com now allows for server-side hooks to be installed. Definitely very cool, check it out: http://blog.assembla.com/assemblablog/tabid/12618/bid/98012/Server-Side-Hooks-on-a-SaaS-repository.aspx