Skip to content

Instantly share code, notes, and snippets.

@jarohen
Created August 18, 2013 19:09
Show Gist options
  • Select an option

  • Save jarohen/6263386 to your computer and use it in GitHub Desktop.

Select an option

Save jarohen/6263386 to your computer and use it in GitHub Desktop.
example git deploy post-receive hook
read oldrev newrev refname
worktree="/usr/local/lib/my-app/src"
if [ "refs/heads/deploy" = "$refname" ] ; then
echo "Pushing changes live:" ;
sudo service my-app stop > /dev/null;
git --work-tree="$worktree" checkout $newrev > /dev/null;
sudo service my-app start;
echo "Deployed!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment