Skip to content

Instantly share code, notes, and snippets.

@barnabyalter
Last active May 3, 2016 16:50
Show Gist options
  • Save barnabyalter/78ecbc3e06e7fbea3f060fc7362c1e84 to your computer and use it in GitHub Desktop.
Save barnabyalter/78ecbc3e06e7fbea3f060fc7362c1e84 to your computer and use it in GitHub Desktop.
#!/bin/bash
FAILOVER_DIRECTORY="/apps/failover_errors"
FAILOVER_REPOS="git@github.com:NYULibraries/library.nyu.edu.git"
FAILOVER_BRANCH="gh-pages"
mkdir -p $FAILOVER_DIRECTORY
if [ -d "$FAILOVER_DIRECTORY" ]; then
cd $FAILOVER_DIRECTORY
git init
git remote add -f origin $FAILOVER_REPOS
git fetch --all
git config core.sparseCheckout true
if [ -f ".git/info/sparse-checkout" ]; then
rm .git/info/sparse-checkout
fi
echo "errors/" >> .git/info/sparse-checkout
git checkout $FAILOVER_BRANCH
git merge --ff-only origin/$FAILOVER_BRANCH
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment