Skip to content

Instantly share code, notes, and snippets.

@mgirouard
Last active December 17, 2015 22:09
Show Gist options
  • Save mgirouard/5679967 to your computer and use it in GitHub Desktop.
Save mgirouard/5679967 to your computer and use it in GitHub Desktop.
An informative post-receive hook. Useful if you do git deployments.
#!/bin/sh
# Receive <oldrev> <newrev> <refname>
read oldrev newrev refname
# The darget of the deployment
target=/var/www/vhosts/www.example.com
echo Deploying to $target
echo =======================================================
git diff --name-only $oldrev..$newrev
echo =======================================================
GIT_WORK_TREE=$target git checkout -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment