I recently put up a new tool on GitHub called git-hooks. This is a tool to manage project, user and global Git hooks for multiple git repositories.
Hooks can be very powerful and useful (as I have previously written about in my git hooks blog post). Some common hooks that I always want running no matter what git repository I am commiting to include:
- Spell check the commit message.
- Verify that any new files contain a copyright with the current year in it.
Every project also has specific hooks that I run 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.
And I have some hooks that are very specific to just me 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.
In the past I have just been copying these from one git repository to another, making symlinks or other nasty hacks. I finally sat down and wrote a tool to manage these different hooks.
After running 'git hooks --install' in a repository rather then using what is in .git/hooks the following locations will be checked for hooks:
- User hooks that are installed in ~/.git_hooks/
- Project hooks that are installed in the git_hooks directory inside of each project.
- Global hooks that are specified with the hooks.global configuration.
If you have many hooks you don't have to write a wrapper to call them all, they all simply go inside of a directory (such as git_hooks/pre-commit/bsd.sh).
git-hooks/contrib also includes various simple hooks I are useful that you might like to use. git-hooks is released under the BSD license.
Git hooks are scripts that are run by Git before or after certain commands. Because the hooks are run locally and not on the server it allo...
A little over a year ago on reddit I saw a picture of a guy sitting on the edge of a rock . Not just any rock, but a clip of a rock that je...
For the 2011 Google Ants AI Challenge rather than doing the typical solution of choosing direction for each ant based upon the shortest pa...
Depending on the definition "code review" can mean a wide variety of things such as formal code review or automated code analysis....
SSD's provide significant improvement in disk IO. How well does that translate over when using Git? A lot. After watching prices dro...
Update: See my more recent blog post Git hooks for a more in depth look at Git hooks. The past few weeks I have started learning Git and ...
I have created a new application called KAudioCreator. It is a front-end tool for ripping and encoding CD's. I am happy to say that KAud...
All through my programming career I have had a whiteboard, but beyond simply making sure I had one I have never thought much more about it. ...
This weekend I created a little application called git achievements . Similar to the XBox360 Achievements you can unlock all sorts of Achie...
I recently put up a new tool on GitHub called git-hooks . This is a tool to manage project, user and global Git hooks for multiple git repo...