All Articles

Writing a Git Hook in Python

I gave a talk at the Boston Python Meetup back in October on using Python to write git hooks. My example was using a git hook to automatically add the titles of the books you are currently reading to your git commits. Why on earth would you want to do this? Well I wanted to do it because I use git to version control my writing, and often times I read my writing and wonder what I was reading at the time that made me write in that way. So it was a git hook that probably only I would use, but it was fun to learn, and even more fun to give a talk about. I’m a big fan of the Boston Python Meetup!

Here’s an example of a git commit:

commit a4d423be1f8ce94380e7ece8c00df0dcf126d170 (HEAD -> master)
Author: Allison King <>
Date:   Mon Oct 21 22:26:01 2019 -0400

    my first chapter
    Steel Crow Saga (Steel Crow Saga, #1)
    The Trainable Cat: A Practical Guide to Making Life Happier for You and Your Cat

Unfortunately the talk was not recorded, but here are the slides, featuring my cartoons, including some of my cat :)