Skip to content

Instantly share code, notes, and snippets.

@ghickman
Created April 5, 2011 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghickman/904708 to your computer and use it in GitHub Desktop.
Save ghickman/904708 to your computer and use it in GitHub Desktop.
Post-Receive hook. Runs when the repository is pushed to.
#!/bin/bash
while read oldrev newrev refname
do
if [ "$refname" == "refs/heads/master" ]; then
WORKDIR=/path/to/local/repo
export GIT_DIR=$WORKDIR/.git
pushd $WORKDIR >/dev/null
git pull --quiet >/dev/null
# run some code
popd >/dev/null
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment