I'm working on getting into some more advanced usage of git, and I think hooks are the way that I want to go, perhaps somebody can give me some advice here.
My plan is to have a git repository with 3 branches (development, staging, and production). I want commits to each of these 3 branches to trigger a different script post-commit.
Does git have the capability to do this or am I barking up the wrong tree?
In a post-commit hook you could do the following:
if [ `git rev-parse --abbrev-ref HEAD` == "development" ]; then
echo "development-script"
elif [ `git rev-parse --abbrev-ref HEAD` == "staging" ]; then
echo "staging-script"
elif [ `git rev-parse --abbrev-ref HEAD` == "production" ]; then
echo "production-script"
fi