In one project I have a set of templates that I want built into a single file for quicker download. Rather than having to run a command manually after a commit I’d rather this was done at commit-time and then added to the commit bundle. I spent a while figuring out how to do this but basically you need to create a file .git/hooks/post-commit (in every repository – it doesn’t get pushed/pulled) containing the following:
#!/bin/sh
# Build templates as you wish eg "perl bin/build_templates.pl"
git diff --quiet compiled_file_name # Did we have any change?
if [ $? != "0" ]; then # Yes - redo previous commit
git commit -C HEAD --amend --no-verify compiled_file_name
fi