Archives for December 2015

Git Hooks

Git is a powerful version control system which has become the de facto standard in recent years (judging by the popularity of Github). Perhaps one of Git’s underused features is its hooks: small scripts that are run whenever a specific action is run. For example, one could set up a pre-push hook that runs the test suite so that breaking changes aren’t inadvertently introduced. Another common use for hooks is to deploy changes. For example, one could have a server hosting a basic Jekyll or Pelican blog and using the post-update hook one could get the server to automatically regenerate the website whenever changes are pushed onto the server. Since Git hooks allow any script to be executed, hooks can be used to automate nearly any task.