Created
September 14, 2014 12:34
-
-
Save jbrains/035dd20f0f0fe64ad16b to your computer and use it in GitHub Desktop.
A safe approach to publish-on-push with git and Wordpress
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/sh | |
# Improved safety by not checking out directly into document root | |
pushd /home/jbrains | |
SCRATCH="$(date +%N)" | |
TARGET="/home/jbrains/domains/jbrains.ca/web/wordpress-jbrains.ca" | |
# Backup | |
tar cf "wordpress-jbrains.ca.$SCRATCH.tar" $TARGET | |
# Clone, then copy | |
mkdir $SCRATCH | |
pushd $SCRATCH | |
git clone /home/jbrains/domains/jbrains.ca/wordpress.git | |
cp -RP wordpress/* $TARGET | |
popd | |
rm -fr $SCRATCH | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment