Skip to content

Instantly share code, notes, and snippets.

@SamjiDiamond
SamjiDiamond / post-receive.sh
Created November 30, 2020 17:12 — forked from benfrain/post-receive.sh
post-receive hook for multiple branches
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
git --work-tree=./path/under/root/dir/live-site/ checkout -f $branch
echo 'Changes pushed live.'
fi