Created
December 21, 2015 21:30
-
-
Save abouthalf/85c5d0bc982b20d554ba to your computer and use it in GitHub Desktop.
Example Git post-receive hook which checks out a repository into another directory. Used for deploying a static site to your server (assuming your web-host has git enabled)
This file contains hidden or 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 | |
| while read oldrev newrev refname | |
| do | |
| branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
| if [ "master" == "$branch" ]; then | |
| # Checkout changes from your static site into your web directory | |
| GIT_WORK_TREE=/path/to/your/web/directory git checkout -f ; | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment