#!/bin/bash target_branch="production" working_tree="PATH_TO_DEPLOY" while read oldrev newrev refname do branch=$(git rev-parse --symbolic --abbrev-ref $refname) if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then GIT_WORK_TREE=$working_tree git checkout $target_branch -f echo " /===============================" echo " | DEPLOYMENT COMPLETED" echo " | Target branch: $target_branch" echo " | Target folder: $working_tree" echo " \==============================" fi done