Writing Git hooks in python/bash scripts

myusuf3 picture myusuf3 · Jul 22, 2010 · Viewed 24.3k times · Source

I have recently needed to write git hooks, for all commits to reference a particular ticket.

I was hoping for a place to start learning. All the stuff in the pro git book is written in Ruby. Since Ruby is not my strong suit, can anybody share tutorials about git hooks written in other languages? (I'd particularly prefer Python or Bash scripts.)

Answer

Peter Loron picture Peter Loron · Jul 22, 2010

Here is an example of using Python for a hook. In general the hooks are language agnostic. You use the script to do some work or to exit with a 0/other return code to alter the flow of a git process.