Created
July 18, 2014 19:34
-
-
Save JanDeDobbeleer/4d94cb047ed86cc556a6 to your computer and use it in GitHub Desktop.
script to copy the working directory from the master after a commit to your cloud storage account to allow automatic backups
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/sh | |
# only deploy when on the master | |
# add this file to .git/hooks in your repo | |
# add your preferred cloud storage account | |
dest="Dropbox" | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
if [ "master" == "$branch" ]; then | |
echo "Deploying to $dest" | |
unset GIT_INDEX_FILE | |
# change this to your cloud storage location | |
export GIT_WORK_TREE=C:/Operations/Dropbox | |
# change this to your repo | |
export GIT_DIR=C:/Users/janjoris/Documents/Git/Operations/.git/ | |
git checkout -f | |
else | |
echo "Not on master, deploy to $dest cancelled" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment