Created
October 31, 2013 13:47
-
-
Save spoeken/7250039 to your computer and use it in GitHub Desktop.
Git post-receive hook for deploying with --bare repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Remember to change /var/www/ to the right dir and chmod +x post-receive | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ "master" == "$branch" ]; then | |
GIT_WORK_TREE=/var/www/ git checkout -f | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment